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.

--

--

Engineering Manager | Big4 ex. FinTech | Writer with +1M views. Sharing my opinion & what I learn. YT channel youtube.com/c/NicklasMillard

Love podcasts or audiobooks? Learn on the go with our new app.

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