Nicklas Millard
1 min readJun 25, 2020

--

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.

--

--

Nicklas Millard

I mostly write to "future me" sharing what I learn and my opinion on software development practices. youtube.com/@nmillard | open for contracts in May 2024.