-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not to having GUID as primary key for all the tables #37
Comments
Can you provide more info about your database? |
I have an existing very complicated DB. That's why I already asked a more complicated sample with more than one Entity which it should have one-one and one-many relation as well. |
Ok, let me see how I can help. Asking for a more complex sample is too generic and it will not happen, it's not planned. |
YES. Thanks. I get lost when I have to monitor events for a complex scenario. I wish it had more than one Model class and handled relations as a sample. |
Can you write a small sample snipped here? Then we can go deep on it. |
1- Some tables do not have GUID as Primary-key and it is integer for example. I did change the AggreatorID from GUID to string and work fine , but I do not know what to do if my table does not have a GUID primary key. |
If I use anything other than GUID as a primarykey, then how to assign to the aggrigatorID ?public Persons(Guid id, string name, string family, string address) the type would be different then. |
It's important that you may use one EventSource entity per Domain entity. |
but I do inherit from Entity class which has a GUID ID in the base class. |
Just remove te Guid Id property from Entity class, and bring it to each Entity specific class. |
so if the primarykey name was not ID and it was not GUID, the aggregateid would not work.Correct?. |
The idea behind the aggregateId is just to keep track on changes through eventsourcing. Just create a Guid.New for it and you will be fine. They don't need to be the same, just need to have one aggregateid per one Entity. Imagine if you have compose key for an entity, you don't create a compose aggregateid , just keep one-to-one relation. |
@AliCharper May we close this discussion? |
I think so, but I have so many other questions which I would ask later. |
If you have an Int key for your tables just change it to Int in this sample. public class Repository<TKey, TEntity> And set your datatype keys as you like. |
Imagine if you have compose key for an entity, you don't create a compose aggregateid , just keep one-to-one relation. Yes, but imagine that I have an existing DB which has so many tables with IN primarykeys or Composite ones. then how can I assign a GUID as an aggregateId ?. |
Hi,
My existing database does not have a GUID as primary key for all the tables. What should I do now?.
The text was updated successfully, but these errors were encountered: