views:

1573

answers:

2

I'm using entities Framework in my project and it has been a nightmare!

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

Form has an ID that is a PK and Identity (it's automatically increased).

This time I'm doing 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 ID and form.ID had the key generated after insert, but now it only has 0.

I don't know what happened for this to stop working.

I had to change the name of the insert, delete and update stored procedures for several tables and so I had to map this all back again. Maybe I did something wrong but I looked time and time again and everything seems ok.

Does anyone have a clue why?

A: 

ok... I forgot about this

http://blogs.microsoft.co.il/blogs/bursteg/archive/2007/12/17/ado-net-entity-framework-tools-stored-procedures.aspx

I had to "use the Result Column Binding, and map the new value to an entity column."

shouldn't Entity Fw do that for me?!

Txugo
+1  A: 

I think this issue has been resolved with patches. You should try to remove and add back your Data Model if it still isn't working. EF seems to have less issues with this now.

RandomBen