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:
GuidDestination: objects implementing
interface IEntity { Guid Id { get; set; } }Mapping configuration
I have tried a lot of solutions mainly configuring
ForAllPropertyMapswhere I am checking if source isList<Guid>and destination implementsIEntitybut I can't seem to get it right.Versions
Expected behavior
Mapping I am trying to achieve is:
its shown for concrete type
Userbut I would like it to work for any class implementingIEntityinterface meaning class that hasGuid IdActual 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
Idproperty 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
IEntitylike so:but I feel there must be more generic solution.
Beta Was this translation helpful? Give feedback.
All reactions