how to make id of model as auto increment

hey hi i wanted to make id as auto increment and any docs are avaliable of database models in webapi
No description
No description
No description
6 Replies
ThePuppetMaster
ThePuppetMaster2mo ago
this is dotnet webapi issue can someone help me with this
Pobiega
Pobiega2mo ago
That's the default behaviour for IDs, not something you need to configure
ThePuppetMaster
ThePuppetMaster2mo ago
@Pobiega every time when i have to hit post request i have to pass id also int the body it can't be generate auto
Pobiega
Pobiega2mo ago
Ah, because your controller action takes the actual entity model itself That's bad. Take a dto instead with only the settable properties, then create an entity with no id in your code before adding to the context After calling savechanges, it should then have an id set by the database
ThePuppetMaster
ThePuppetMaster2mo ago
and also you have any idea about this https://discord.com/channels/143867839282020352/1225674143362453576 please help @Pobiega
Pobiega
Pobiega2mo ago
did you get this working?