0
votes

I 'm working on an ASP.NET Dynamic Data Entities Web Application.

When trying to insert a new entry in one of the tables, with some value in the column_name field, I get the following message :

Cannot insert the value NULL into column 'column_name', table 'DATABASE.dbo.table_name'; column does not allow nulls. INSERT fails.

The column properties are :

  • Entity Key : True
  • Nullable : False
  • Type : String

I believe Dynamic Data is trying to send null value to entity framework for some reason, but I don't know which.

Do you know why Dynamic Data is behaving that way ? Or have you any idea how to debug the insert process ?

Thanks

1
It might help if you post the offending code. - NightOwl888
Well, there isn't any specific code, the problem comes with the out of the box project. I just created a new Dynamic Data Entities Web Application from visual studio's list of projects and then connected it to a sql server database. I then uncomment the following line in global.asax file : DefaultModel.RegisterContext(typeof(DATABASENAMEEntities), new ContextConfiguration() { ScaffoldAllTables = true }); routes.Add(new DynamicDataRoute("{table}/{action}.aspx") { Constraints = new RouteValueDictionary(new { action = "List|Details|Edit|Insert" }), Model = DefaultModel }); - Yvain

1 Answers

1
votes

I found where the problem come from. A table from the database the model is based contains a trigger. For some reason the model makes an association between the two tables involved in the trigger.