You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetException: Non-static method requires a target.
Can you help me to understand why I get this error ?
The text was updated successfully, but these errors were encountered:
I think you need to use .Function instead of .Member when you try to use MethodCallExpression in other words when you have .Member(dst => dst.AssignedValue, src => EvaluateList(src.TaskUsers, t => t.RoleType == Enums.RoleTypeEnum.Assigned).UserName) rewrite it to .Function(dst => dst.AssignedValue, src => EvaluateList(src.TaskUsers, t => t.RoleType == Enums.RoleTypeEnum.Assigned).UserName)
Hello,
I try to map two class TaskEntity and TaskListItem like that:
Mapper.Register<TaskEntity, TaskListItem>() .Member(dst => dst.AddressValue, src => src.Addresses.ToString()) .Member(dst => dst.AssignedValue, src => EvaluateList(src.TaskUsers, t => t.RoleType == Enums.RoleTypeEnum.Assigned).UserName) .Member(dst => dst.CompleteDateValue, src => src.DeliveryDate) .Member(dst => dst.DeadlineValue, src => src.Deadline) .Member(dst => dst.LessorValue, src => EvaluateList(src.TaskUsers, t => t.RoleType == Enums.RoleTypeEnum.OfficeManager).UserName) .Member(dst => dst.StatusValue, src => src.TaskStatus.Description) .Member(dst => dst.SynchDateValue, src => src.CreationTime) .Member(dst => dst.TemplateTypeValue, src => src.Template.TemplateType.NameKey) .Member(dst => dst.TenantValue, src => EvaluateList(src.TaskUsers, t => t.RoleType == Enums.RoleTypeEnum.CustomerManager).UserName) .Member(dst => dst.TypeOfMissionValue, src => src.ContractType);
I use it like:
List<TaskListItem> taskItems = (List<TaskListItem>) taskEntities.Map(typeof (List<TaskEntity>), typeof (List<TaskListItem>));
And I get this error:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetException: Non-static method requires a target.
Can you help me to understand why I get this error ?
The text was updated successfully, but these errors were encountered: