c# - Entity Framework 5 not loading property -


i'm working on ef5 code-first database , giving me lot of trouble on foreign key. sorry if answered somewhere else looked @ countless of questions on here , none helped far.

i have user class

public class user {     [key()]     [hiddeninput(displayvalue=false)]     public int userid { get; set; }      [required]     public string username { get; set; }      [required]     [datatype(datatype.password)]     public string password { get; set; }      [scaffoldcolumn(false)]     public customclass custom { get; set; } } 

and custom class

public class customclass {     [key()]     [hiddeninput(displayvalue = false)]     public int customclassid { get; set; }      [required]     public string name { get; set; } } 

and datacontext

public class silkdbcontext3 : dbcontext {     public dbset<user> users { get; set; }     public dbset<customclass> customclasses { get; set; } } 

now, problem can save poseanimation through controller. can post , update user basic properties (username, password), when add custom class user, saves foreign key in database row, when want retrieve user, dbcontext gives me null custom class (whether i'm retrieving through or intellisense). can me out here?

you'll need either explicitly or eagerly load related data, or mark custom property virtual if you're using lazy loading.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -