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
6 Replies
this is dotnet webapi issue can someone help me with this
That's the default behaviour for IDs, not something you need to configure
@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
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
and also you have any idea about this https://discord.com/channels/143867839282020352/1225674143362453576 please help @Pobiega
did you get this working?