Support for strongly-typed IDs #2046
-
Hello! First of all I would like to thank all contributors, I really find this project very unique and interesting! I encountered an issue regarding strongly-typed IDs. In my project I use DDD and create custom classes for IDs, like in this example:
And consume it in a following way:
Then I'm trying to tell Marten which value is an ID:
But unfortunately such setup results in an ArgumentOutOfRangeException:
In EF Core I could easily provide convertion to/from GUID:
Is there any workaround for this issue or shall I just use pure GUID? Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Heh, I just closed the last issue someone opened for strongly typed ids. I'm against doing this in Marten tbh, because I just don't want the extra complexity. You could possibly use this as is with Marten by making your strong typed id types be implicitly convertible to the Marten supported identifier types like an int, long, string, or Guid. |
Beta Was this translation helpful? Give feedback.
Heh, I just closed the last issue someone opened for strongly typed ids. I'm against doing this in Marten tbh, because I just don't want the extra complexity. You could possibly use this as is with Marten by making your strong typed id types be implicitly convertible to the Marten supported identifier types like an int, long, string, or Guid.