Generate a marker interface IVogenValue<T>
Describe the feature
It would be really useful, if the generated type would implement a marker interface like IVogenValue<T>.
This would enable us to check for such interface when adding a generic mapping function to a mapper library like AutoMapper, Mapperly or Mapster.
I am currently using Mapperly, and my static mapper class looks like this
private static int ToInt(Count count) => count.Value;
private static int ToInt(CircuitId id) => id.Value;
private static int ToInt(PublisherId id) => id.Value;
private static int ToInt(PublisherProfileId id) => id.Value;
private static string ToString(IPhoneNumber phoneNumber) => phoneNumber.Value;
private static string ToString(EmailAddress emailAddress) => emailAddress.Value;
this screams DRY! and could be replaced by
private static T ToPrimitive<T>(IVogenValue<T> valueObject) => valueObject.Value;
Edit: well, it's still not working in Mapperly, because of https://github.com/riok/mapperly/issues/1285 but it would work in AutoMapper...
Could you please check if IVogen<TSelf, TPrimitive> solves the issue? For more details, please refer to the documentation.
@marcwittke did @shupoval 's suggest solve your issue?
I did not dig further into it because I prefer to use mapperly over others, and just with this library my idea wouldn't work either. But it looks like exactly what I was looking for, yes.