Rupesh Kahane

Rupesh Kahane

  • 102
  • 19.1k
  • 4.2m

How to use parameter array navigation properties EF linq ?

Jan 6 2017 2:14 AM
I have a table structure with relationship in between three tables.
I have added edmx file into my project as below.
 
 
 
I would like to use parameter array navigation properties entity framework using linq.
 
I have written some code in controller like 
  1. <Expression> parames1 = v => v.LoginInfo;     
  2. <Expression> parames2 = v => v.LoginInfo.UserDetail;     
  3. <Expression> [] paramesArray = new Expression>[] { parames1, parames2 };     
  4. var userPost = UnitoffWork.UserPostRepository.GetAll(navigationProperties: paramesArray).Select(u => new HomeViewModel(u));   
 I am not able to implement this.
 
getting some errors like
1. parames1 does not exist.
2. can not create an instance of abstarct class or interface 'System.Linq.Expressions.Expression' 
 
Please suggest how can i get all data in single variable from mutliple tables.
Thanks 

Answers (3)