How can I add selected streams to organizations in the links to project in an anonymous form? Sometimes I only have to request some qualities of my person class: And I must also request the same qualities of the specific qualities of my employees as well as: Is it possible with the manipulation of tree-tree ( or other solutions ) that not to duplicate all selected streams of two persons from my person unit Can you add two selected clauses? Something like this: No There is no way to do what you are asking. The problem is that each anonymous type has to be compiled at compile time, but the expression trees work on runtime. I can see two ways of working around it: In both cases, you need some expression tubes, but it should not be difficult to do so.
Let me assume that I have these entities:
address of public category {public string city {receive; Set; } Get Public At Zipcode {}; Set; } // other properties} public class person {public string name {get; Set; } Public Address Address {get; Set; } / / A lot of other qualities} // Employees with special characteristics to increase the person class: the public class employee: person {public double pay; Set; } Public Public Manager {get; Set; }}
Context.Persons .Where (.. ..) Choose (P => New {p.Name, PersonCity = p.Address.City, // other essential properties});
context Employees of Type & Lieutenant; Employee & gt; (). where (...). Select (e => New {e.Salary, ManagerName = e.Manager.Name, e.Name, PersonCity = e.City.Name, // Similar properties of previous selection with other required person's entity}};
var personSelect = p = & gt; New {p.Name, PersonCity = p.Address.City, // other essential properties}; Var EmployeesHeck = PersonSock. Combine (E => New {E. Salary, Managername = AD Administrator.name}); Context.Employees.OfType & LT; Employee & gt; () Where (...) Select (employeeSelect). FirstOrDefault () .; // An anonymous item // //name = "Joaquim", // PersonCity = "Lyon", //
PersonData for your employee Code> is a name that contains an anonymous type with information from person . PersonData and employee data (from the PersonData ) . Each type will be able to give you an expression to make it and the expression of employee data will be calculated based on the expression of PersonData .
No comments:
Post a Comment