c# - Object reference not set to an instance of an object model fk and virtual field -
this used work. upgraded entity framework 6.1.1 today , have error.
i'm getting object using linq this:
models.university myuni = dal.university.getbyid(convert.toint16(university.selectedvalue)); lbluniname.text = myuni.name; lblunilang.text = myuni.language.name;
when trying view myuni.language
null
this model:
public int? language_id { get; set; } [foreignkey("language_id")] public virtual language language { get; set; }
what doing wrong?
make sure lazy-loading in not turned-off in configuration:
this.configuration.lazyloadingenabled = true;
see msdn
Comments
Post a Comment