That's more of a statement, and not much of a question.

But, it makes sense when using e.g. CQS/CQRS, and you require the ID after database insert.

If you let the database generate the ID in that case, you'd have to either 1) make the command return an ID, which is not ideal, since commands should not return anything, or 2) have to immediately perform a query to get the newly created ID.

It make more sense in this case to let the application or domain entity itself create the id.

Written by

Tech writer with 621K+ views. Sharing my opinion and what I learn. Danish C# backend engineer in FinTech. Ex Big4 senior tech consultant.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store