linq - How can I create an Expression within another Expression? -


I'm sorry if I have already started using LINQ only if I have already said I have the following expression:

  public steady expression & lt; Funk & lt; TblCustomer, customer satisfaction & gt; & Gt; SelectToSummary () {Return M = & gt; (New Customer Sommerie () {ID = MID, Customer Name = M. Customer Name, Last Sale Contact = // This is a person entity, no one knows how to make it}); }  

I want to be able to populate LastSalesContact , which is a person unit.

Details that I want to populate from m.LestestPerson , then how can I map to m.LestestPerson to fields LastSalesContact . I want to use mapping again, that is, I do not want to do this:

  lastcell communication = new person () {// etc}  

Can I use a static expression, such as:

  public static expression & lt; Funk & lt; TblUser, User & gt; & Gt; SelectToUser () {return x = & gt; (New user () {// populate}); Update:   

I need to:

  return m = & Gt; (New customer summary) {ID = MID, CustomerName = M. CustomerName, LastSalesCommission = New Person () {PersonId = m.LatestPerson.PersonId, PersonName = m.LateestPerson.PersonName, Company = New Company () { CompanyId = M.LatestPerson.Company.CompanyId, etc}}});  

But I'm reusing the person () creation in 10 to 15 different sections, so I do not want to duplicate the exact same code I could probably company .

Would you like to do the same? Do not you use it?

  Public steady expression & lt; Funk & lt; TblCustomer, CustomerSummary & gt; & Gt; SelectToSummary () {Return M = & gt; Mapper Map & lt; TblCustomer, CustomMonkey & gt; (M); }  

You have to do some bootstrapping, but then it will be very reusable.

Update:

I am not getting anything, but what is the purpose of this function? If you want to map only the collection of one object or other objects, then why is the expression?

You may have something similar:

  var customer = _customerRepository. All received (); // Returns IEnumerable & lt; TblCustomer & gt; Var Summary = Mapper Map & lt; IEnumerable & lt; TblCustomer>, IEnumerable & lt; Customer's Summy & gt; & Gt; (Customer);  

Am I missing something?


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -