Mapster
Mapster copied to clipboard
Source Generators with IMapper Interface
Hello, I am using mapster with fec and I am very happy :) But i am curious about something.. Is there any way for using source generators which is Mapster.Tool and IMapper interface?
So I want to still inject IMapper interface to my classes but I want use source generated mappings.
I too was searching for it. It would certainly be great to have!
If there is Source Generator supports for IMapper, that would take Mapster a few steps up. It would be the most common library for AOT base apps. I'd like to contribute to this development tho!
I think this is a great suggestion, however there may be a showstopper. Currently only netstandard2.0 assemblies can be used as source generators. Since Mapster and its constituent components are all net6.0/net7.0/net8.0 currently, I think it's currently not possible to run a source generator from Mapster. I might be wrong, this is just based on a quick readup on requirements for source generators, so I'm eager to hear your thoughts on this. It might be theoretically possible to bring netstandard2.0 back into Mapster, but it requires quite a few code changes since Mapster now relies on features not available in netstandard2.0.
I think that this is not an issue anymore