I have a table with a primary key of bigint not null. It is NOT defined as a identity column. I have created a simple stored procedure to handle the record insert and getting and setting primary key column. Also the stored procedure defines the primary key column as an output parameter. My hope was to wire the stored procedure into linq with classes.
Steps: 1) Dragged the table on to the design surface 2) Dragged the stored procedure to the design surface 3) Selected the table in the designer 4) Then selected the properties window 5) Clicked on the elpise next to "Insert" 6) In the "Configure Behavior" window selected "Custom" 7) Then selected the stored procedure (all columns match up nicely) The designer generates the attached code snippet (snip.txt).
I have set break points inside both of these generated method calls and run my unit test. SQL Profiler demonstrates that the Linq dynamically generated sql is sent to the sql server and this generated code is never called. The insert is done successfully in the database but the primary key column is set to "0". So the overall mechinism is wired up correctly but just doesn't use the custom stored procedure.
Ok, I am trying to create your problems here, but I am not able to. I did the following just like you: 1) Dragged the table on to the design surface 2) Dragged the stored procedure to the design surface 3) Selected the table in the designer 4) Then selected the properties window 5) Clicked on the elpise next to "Insert" 6) In the "Configure Behavior" window selected "Custom" 7) Then selected the stored procedure (all columns match up nicely)
Then I went to my page and: 1) added a LinqDataSource 2) picked my db 3) enabled inserting 4) added a detailsview 5) associated with the LDS 6) Enabled inserting
And my test SP went off without a hitch.
Go in to your dbml to verify that teh sp is being called as your insert. Once that is done, make a test page and follow what I did, keep it as basic as possible and see if the problem still occurs.