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
ThePuppetMasterOP9mo ago
this is dotnet webapi issue can someone help me with this
Pobiega
Pobiega9mo ago
That's the default behaviour for IDs, not something you need to configure
ThePuppetMaster
ThePuppetMasterOP9mo 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
Pobiega9mo 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
ThePuppetMasterOP9mo ago
and also you have any idea about this https://discord.com/channels/143867839282020352/1225674143362453576 please help @Pobiega
Pobiega
Pobiega9mo ago
did you get this working?
Want results from more Discord servers?
Add your server