c# - Entity Framework does the data type effect the behavior of PropertyConfiguration methods? -
assuming
public int? count { get; set; } are following 2 statements equal?
property(v => v.count).hascolumnname("count"); property(v => v.count).hascolumnname("count").isoptional(); does hold true complex data types, say:
public foo bar { get; set; } property(v => v.prop1).hascolumnname("prop1"); property(v => v.prop1).hascolumnname("prop1").isoptional();
in first case, yes, 2 statements equal in terms produce same ddl.
in second case, if foo complex type, means bar navigation property. , should treat navigation properties differently in configuration, eg:
hasrequired(x => x.bar).withmany().hasforeignkey(x => x.barid) or
hasoptional(x => x.bar).withmany().hasforeignkey(x => x.barid) depending on intended relationship.
Comments
Post a Comment