shyam j

shyam j

  • NA
  • 26
  • 419

about entity framework auto-generated model class object

Aug 23 2018 12:07 PM

hi,
 i have a user table and language table, in user table have two fields 1)first language 2) second language foreignkeys from the language table.
now when I generated model using framework it generating virtual objects language and language1 but I need firstlanguage and second language
 
bellow code is model generated  code
  1. public class user    
  2. {    
  3.         public int Id { getset; }    
  4.         public int Firstlanguage { getset; }    
  5.         public int SecondLanguage { getset; }    
  6.         
  7.         public virtual Language Language { getset; }    
  8.         public virtual Language Language1 { getset; }    
  9. }    
  10.     
  11. public class Language    
  12. {    
  13.         public int Id { getset; }    
  14.         public string Name { getset; }    
  15. }   
Usage of user class
  1. var data=db.user.include(p=>p.Language).include(p=>p.Language1);  
  2. //here i can't able to recognize what is language and language1  
Here i need to get query like this
  1. var data=db.user.include(p=>p.FirstLanguage).include(p=>p.SecondLanguage);  
 
 
 
 
sa 

Answers (2)