I'm learning Entity Framework under VC# 2010.
I have created a simple table for learning purposes, one of the fields is "id" type integer, identity set to true. I've generated Entity Data Model from that table and connected it with dataGridView. The problem is that it doesn't auto increment - each inserted row wants to be id=0 (which is impossible of course, since id must be unique)
What am I doing wrong? How should I configure EF or the SQL db itself?
Check in your EDMX model, that the autoincrement field's StoreGeneratedPattern attribute is set to "Identity". In this way, EF knows that the autonumbers are handled by the DB.
Here this is explained better: Autonumber with Entity Framework
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With