I am using SQL Server 2005 with SelfServicing entities and ASP.NET 2.0.
On an ASP page, I have an LLBLGENDataSource connected to an EntityCollection. The datasource is bound to a DetailsView control.
When I debug and click "New" on the control and save it by clicking the "Insert" link I get this error:
ORMQueryExecutionException:
An exception was caught during the execution of an action query: Cannot insert the value NULL into column 'id' column does not allow nulls. INSERT fails.
The statement has been terminated.
The problem is that the primary key is null. Of course I don't the user to have to input the primary key into a field every time they want to create a new entity. So my question is, how do I get the entity to automatically generate a primary key when the entity is saved and an insert is called? I tried putting this in the object constructor but it didn't seem to work:
id = Guid.NewGuid();
Thanks in advance!