Wednesday 4 January 2017

Entities in 'Y' participate in the 'FK_Y_X' relationship. 0 related 'X' were found. 1 'X' is expected

I think you did not  make optional relation ship in mapping.
you should make Hasoptional
example

1 -Correct

  HasOptional(t => t.Y)
                .WithMany(t => t.X)
                .Map(a => a.MapKey("YId"));




2-Incorrect


HasRequired(t => t.Y)
                .WithMany(t => t.X)
                .Map(a => a.MapKey("YId"));

No comments:

Post a Comment