Replies: 1 comment
-
You can try this, or something along those lines. There are more examples on the docs. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have run out of places where to ask sorry for spamming issues with questions.
Source/destination types
Source:
Guid
Destination: objects implementing
interface IEntity { Guid Id { get; set; } }
Mapping configuration
I have tried a lot of solutions mainly configuring
ForAllPropertyMaps
where I am checking if source isList<Guid>
and destination implementsIEntity
but I can't seem to get it right.Versions
Expected behavior
Mapping I am trying to achieve is:
its shown for concrete type
User
but I would like it to work for any class implementingIEntity
interface meaning class that hasGuid Id
Actual behavior
Mapping throws an error.
Steps to reproduce
Here is fiddle with one of my many attempts
https://dotnetfiddle.net/Widget/vvmnog
I think I am trying to achieve something which should be very common your DTOs contains list of ids but your entity has list of entities and I would like to map to them such that they have only
Id
property set which is all you need to provide to entity framework db context.Here is example command handler for type of code I have in my app
I was able to make it work by handwriting map for every class implementing
IEntity
like so:but I feel there must be more generic solution.
Beta Was this translation helpful? Give feedback.
All reactions