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
Mapping to interfaces seems not to work.
with config.ForType<PBPatient, IPatient>() .ConstructUsing(src => new Patient());
I get the following error:
System.ArgumentException : Expression of type 'System.Linq.Expressions.Expression1[System.Func2[PBPatient,Business.Patient]]' cannot be used for parameter of type 'System.Linq.Expressions.Expression1[System.Func2[PBPatient,IPatient]]' of method 'System.Linq.IQueryable1[IPatient] Select[PBPatient,IPatient](System.Linq.IQueryable1[PBPatient], System.Linq.Expressions.Expression1[System.Func2[PBPatient,IPatient]])'
Result StackTrace:
at System.Linq.Expressions.Expression.ValidateOneArgument(MethodBase method, ExpressionType nodeKind, Expression arg, ParameterInfo pi)
at System.Linq.Expressions.Expression.Call(MethodInfo method, Expression arg0, Expression arg1)
at Mapster.TypeAdapterConfig.CreateProjectionCallExpression(TypeTuple tuple)
at Mapster.TypeAdapterConfig.Compile()
However if I use config.ForType<PBPatient, IPatient>() .ConstructUsing(src => new Patient() as IPatient);
I get the following error:
System.InvalidOperationException : Input ConstructUsing is invalid for projection: TSource: PBPatient TDestination: IPatient
Is there a workaround to Support Interfaces?
The text was updated successfully, but these errors were encountered:
Tip77
changed the title
Map to interfaces
ConstructUsing not working when mapping to interfaces
Jun 16, 2016
Mapping to interfaces seems not to work.
with
config.ForType<PBPatient, IPatient>() .ConstructUsing(src => new Patient());
I get the following error:
However if I use
config.ForType<PBPatient, IPatient>() .ConstructUsing(src => new Patient() as IPatient);
I get the following error:
Is there a workaround to Support Interfaces?
The text was updated successfully, but these errors were encountered: