data access

Topics: Writing modules
Aug 2, 2011 at 8:55 PM

we have a problem with the dataaccess when we try to create a new entry we always get :

Cannot insert the value NULL into column 'Id', table 'orchard.dbo.SEN_TIME_TIMESRecord'; column does not allow nulls. INSERT fails.
The statement has been terminated.


what can be the reason?


thank you so much



Aug 2, 2011 at 8:56 PM

Your Id table probably wasn't properly declared in the migration.

Aug 3, 2011 at 4:53 AM
Edited Aug 3, 2011 at 5:41 AM

you were right!

now i dont get this anymore!

But if i create a new entry via IRepository the id in the model is autoincremented as it should, but it never reaches the database :(

no error and nothing.


is it possible that the transaction is completed as soon as the controller method is closed, for some reason now it works..

Aug 3, 2011 at 11:34 PM
Edited Aug 3, 2011 at 11:34 PM

Yes, there is an ambient implicit  transaction around everything you do in Orchard. It gets rolled back if there is an exception.