Β© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#β€’4y agoβ€’
14 replies
sonodan.

Using SQL db to create object ID or application?

I have an application where my records in my DB need to have unique IDs. Should I leave this responsibility to the SQL db to create them or should this be handled on the application side?

If the former, if I insert a new record input the db and it auto-creates its ID, is the best practice to use output SQL command to read that ID value from the DB and attached it to my object in memory?

If the latter, are there any best practice patterns to handle IDs that you recommend?

Thanks in advance!
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ SQL Table to Object
C#CC# / help
3y ago
azure sql and cosmos db access testing using dotnet
C#CC# / help
16mo ago
SQL code invalid object name
C#CC# / help
17mo ago