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
Mapperly provides configuration attributes in Riok.Mapperly.Abstractions. For reference handling, a default implementation of IReferenceHandler is also provided in Riok.Mapperly.Abstractions as PreserveReferenceHandler. The PreserveReferenceHandler is the only runtime dependency of the code generated by Mapperly (only if reference handling is enabled).
If reference handling is not used PrivateAssets="all" ExcludeAssets="runtime" can be set which eliminates the need of Riok.Mapperly.Abstractions as a runtime dependency.
We should improve the documentation on this (document PrivateAssets="all" ExcludeAssets="runtime" on the installation page) and try to eliminate the runtime dependency. Sadly we cannot set DevelopmentDependency=true, since this does not work for source generators.
Ideas on how to eliminate the runtime dependency on Riok.Mapperly.Abstractions:
Emit the PreserveReferenceHandler class from the source generator if reference handling is enabled
If the class is emitted as an internal class in a Mapperly namespace, this could lead to duplicated symbols when InternalsVisibleTo is set
The class could be emitted as a file scoped class. Mapperly would need to generate the class for each mapper using reference handling and would require C# language version 11.
The class could be emitted in a namespace which is dependent on the name of the assembly.
Create a new NuGet package Riok.Mapperly.ReferenceHandling which a user needs to reference when enabling reference handling.
The text was updated successfully, but these errors were encountered:
Creates a new Riok.Mapperly.Templates project with templates. Some Mapperly features may require such a template (currently only the reference handling). If such a template is required by a used Mapperly feature, Mapperly emites the template in a namespace which includes the name of the assembly of the target project. This is done to prevent collisions when using InternalsVisibleTo (see #685).
Currently the only themplate is the PreserveReferenceHandler which is emitted if reference handling is enabled for any mapper and the mapper does have mapper method definitions without a reference handling parameter and Mapperly needs to instantiate a IReferenceHandler.
Rel. #666.
Mapperly provides configuration attributes in
Riok.Mapperly.Abstractions
. For reference handling, a default implementation ofIReferenceHandler
is also provided inRiok.Mapperly.Abstractions
asPreserveReferenceHandler
. ThePreserveReferenceHandler
is the only runtime dependency of the code generated by Mapperly (only if reference handling is enabled).If reference handling is not used
PrivateAssets="all" ExcludeAssets="runtime"
can be set which eliminates the need ofRiok.Mapperly.Abstractions
as a runtime dependency.We should improve the documentation on this (document
PrivateAssets="all" ExcludeAssets="runtime"
on the installation page) and try to eliminate the runtime dependency. Sadly we cannot setDevelopmentDependency=true
, since this does not work for source generators.Ideas on how to eliminate the runtime dependency on
Riok.Mapperly.Abstractions
:PreserveReferenceHandler
class from the source generator if reference handling is enabledInternalsVisibleTo
is setRiok.Mapperly.ReferenceHandling
which a user needs to reference when enabling reference handling.The text was updated successfully, but these errors were encountered: