Presentation
I have a ContactProfileModel
entity class with some properties :
- FirstName
- LastName
- BirthDate etc..
I have other Entities who have a ContactProfileModel
foreignkey. Example : RegistrationModel.Contact
.
Needs
I would like to create a method whith the Following signature :
public static Expression<Func<TModel, string>> Contact<TModel>(Expression<Func<TModel, ContactProfileModel>> contact)
And use it this way :
DisplayQuery.Contact<RegistrationModel>(m => m.ContactProfile))
Objective
The objective is to return a linq query where result is a string and contains different informations of the contact. Example : "John Doe (10/10/90)"
Note
I have discussed with some people who told me to use Expression.Call
and Expression.Property
but unfortunatly I do not have enough knowledge to use it properly.
Here I expose my problem without extra details, but I have my reasons to create my method only this way.
Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire