Open Orace opened 1 year ago
@Orace Which version of Mapster are you using?
@andrerav, the last one available on NuGet: 7.3.0, the demo code run on .Net7
Could you try the latest prerelease please?
@Orace @andrerav
This is #537
Id Detect as Record
adapt Guid to Id is Not possible The following reasons: 1) Members of Guid and Id is not match 2) ID does not contain a constructor through which an ID can be created based on the members of the Guid
then:
1) A new guid instance is created.
2) Which then initializes a new instance of Id through the constructor
Having learned this, I added the constructor from the Guid to ID and everything worked.
And naming of Member TSource and parameters in ctor TDestination Must be equal according to the used Naming convention
public Id(uint a, ushort b, ushort c, byte d, byte e, byte f, byte g, byte h, byte i, byte j, byte k)
{
_guid = new Guid(a,b, c, d, e, f, g, h, i, j, k);
}
From then TDistination detect as class it work
Could you try the latest prerelease please?
@andrerav, It fails with 7.4.0 too.
From this SO question.
Given the type
Id
:Despite the implicit conversion Mapster fail to map a
Guid
to anId
:Demo code available here.