When creating domain model, we almost always have Id field or property for our entities which represents the primary key column of corresponding table in the database. My question is - if I have this key property that has nothing to do with the domain model (in other words, it's just database concern; Martin Fowler prefers to name it meaningless key), is persistence layer leaking into my domain? And if it is, how do I prevent it?
Look at the problem another way: Will hiding the Primary Keys make it easier for your team to develop the solution, or make it even harder?
Don't worry about PK values 'leaking' into your entities - I'm sure your software has bigger problems that need to be solved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With