Mapster icon indicating copy to clipboard operation
Mapster copied to clipboard

dotnet mapper ... -p generates code that can't be compiled.

Open jvmlet opened this issue 2 years ago • 0 comments

We have POCOs with the same type name in different namespaces. Adding -p fixes the ambiguous reference, but generates enum mapping like

Mapster.Utils.Enum<x.y.z.E>.Parse(Mapster.Utils.Enum<a.b.c.E>.ToString()),

that fails to compile with error

The type or namespace name 'Utils' does not exist in the namespace 'xxxxxxx'

Same for Mapster.TypeAdapter<T1,T2>

To fix, please render

using Mapster;
using Mapster.Utils;

and non-qualified Enum<SomeType>.Parse()... even if -p is requested.

Thanks

jvmlet avatar Nov 26 '23 14:11 jvmlet