Entity Framework - SaveChanges () does not receive the generated Identity key

I use Framework entities in my project, and it was a nightmare!

I have SQL DB, I have a table called Form.

The form has an identifier, which is PK and Identity (it automatically increases).

This time I do this:

Dim form as int32
Dim dbform As New Entities1
Dim form696 As New Form

dbform.AddToForm696(form)
dbform.SaveChanges()

ID = form.ID

A week ago, the ids and form.ID had a key generated after insertion, but now it has only 0.

I do not know why this happened to stop working.

I had to change the name of the insert, delete and update the stored procedures for several tables, and so I had to display it all again. Maybe I did something wrong, but I looked again and again, and everything looks fine.

Does anyone know why?

+3

Source: https://habr.com/ru/post/1713625/


All Articles