Open SitamMatt opened 3 years ago
I have the same issue and am interested in your workaround :)
Hi,
My solution has several projects:
Contracts and Domain projects should be clean and pure as much as possible.
I want to generate DTOs from Domain and put to Contract, and i want to use fluent API for registration in Application project.
public class MapsterRegister : ICodeGenerationRegister
{
public void Register(CodeGenerationConfig config)
{
config.AdaptTo("[name]Dto")
.ForType<ProjectDocument>();
config.GenerateMapper("[name]Mapper")
.ForType<ProjectDocument>();
}
}
How can i do this trick?
Hi, I tried to generate an extension mapper for two classes defined in external assemblies (in attached repo, it's dto and model projects). Running mapster tool does nothing in that case. However everyting works fine if I register classes inside current assembly. Here is the link to the example project showing the problem - https://github.com/SitamMatt/Mapster-external-classes-registring-example Run:
inside mappers project
From what I've found out studying the source code it's because mapster tool cannot access those assemblies. My workaround was to modify the tool to pass as arguments multiple assembly paths - including those which contains classes to be mapped.
So my question is - Is there any other official way to achieve mappers generation for external classes or could you be intersted to let me create the PR for my workaround ?