c# - Retrieving data from related tables via EF6 and Linq -


I used the first process of code to create several SQL tables.

  public class person {[Key] Public Entry ID (Received); Set; } Public string first name {receives; Set; } Public String LastName {get; Set; } Public Title Type Title {get; Set; }} Public class title type {public entry id (get; set;} public string name {get} set;}}  

In my code I get a person to retrieve the following I am using syntax.

  person person = db.person.find (id);  

I use the properties of a person properly But I can not use the property named Title Type

  var with MyTitle = person.Title Yes.  

Is my code the first code correctly structured or do I need to change some relationships? Currently it just gives a blank.

< Hr>

Here is my reference class

  Public partial class MyContext: DbContext {static MyContext () {Database.SetInitializer  (zero);} Public MyContext ( ): Base ("name = mycontext") {} Public DbSet & lt; person & gt; person {get; set;} public DbSet  title publ Get {X; set; } Safe Override Zero OnModelCreating (DbModelbuilder Modalbilder) {}}  

It seems that your Try to load property content with interest:

  person = db.presence.indu ("title"). FirstOrDefault (x => x.Id = ID =);  

Comments