Combined PK on Inline Projection #3545
-
Hi, I'm doing my first steps with Marten and Wolverine and loving it so far, but it's a lot, it's complex. I could figure out a lot on my own, but now I found something that is not part of the docu, or I was blind and didn't found it. Let's have simple Hello World type of scenario. I have an aggregate public string Username {get;set;} public List Processes { get; set;} = []; public UserAggregate Apply(ProcessCreated e) ... public class Process public string Name {get;set;} And I want to split this up into two projections public class ProcessProjection: EventProjection public class User public string Username {get;set;} public class Process public string Environment {get;set;} public string Name {get;set;} It's psuedocode, it will not compile :) My issue is now, how do I tell Marten to create a combined Primary Key for the second table over the 3 columns, they are unique for every User, but multiple Users can have the same Processname in the same Environment. That concept is not clear to me, how to have nice small special read only tables, what is the Query part of CQRS. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hey, please use Discord for quicker responses to questions. I don't watch the Discussions very closely and hence, the pinned discussion asking you to use Discord. Marten doesn't support composite keys, full stop. The easy way to work around that would be a get only string property that smushes the 3 things up into one string value, then use that as the identity. |
Beta Was this translation helpful? Give feedback.
Hey, please use Discord for quicker responses to questions. I don't watch the Discussions very closely and hence, the pinned discussion asking you to use Discord.
Marten doesn't support composite keys, full stop. The easy way to work around that would be a get only string property that smushes the 3 things up into one string value, then use that as the identity.