Sunday, May 13, 2018

EF Core Zero Int Navigation Properties

I have a very poorly designed database. Granting that.

Is there anyway to have EF core consider a Navigation property with a foreign key value of '0' to be null? And to ensure 0 is saved in the case of a null navigation property value?

In their infinite wisdom, the designers of this database decided that FKs were a bad idea, and that instead they'd use 0 for relationships instead of null.

I'm guessing the answer is "no." But, if there were such a thing, I'd expect it to be on the Navigation property metadata, with some sort of EmptyNavigation(0) extended property. Or maybe hidden inside of Relational() or some other thing. But, I can't find it.

EF Core Zero Int Navigation Properties Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team