I am using Automapper where I am trying to invoke following method:
**IMappingExpression ForMember(string name,
Action<IMemberConfigurationExpression> memberOptions)**
In second parameter Action contains an interface which has method
**void MapFrom<TSourceMember>(Expression<Func<TSource, TSourceMember>>
mapExpression)**
For this method I have created local method which returns
expression<func<object,string>>
Now I am confused how can I dynamically invoke ForMember method by passing the required parameters I have.
Following is the expected result I want to achieve dynamically:
**map.ForMember(x.Key, opt => opt.MapFrom<string>(LocalMethod<object>(x.Value)));**
Where map is object of Automapper's configuration and LocalMethod returns an expression is as following:
**public static Expression<Func<T, string>> DefaultFilter1<T>(string fieldName)
{
}**
Aucun commentaire:
Enregistrer un commentaire