Field has no default value
Posted: Fri 12 Sep 2014 09:34
I have a class with the following ID.
Name: ID
Store Generated Pattern: Identity
Entity Key: True
Nullable: False
Type: Guid
Validation Required: True
I use the POCO template.
When I now try to add a new object with a set ID, I get an error that the field ID has no default value although the value is set.
Any suggestion why it asks for a default value although a value is given?
Thanks
Daniel
Name: ID
Store Generated Pattern: Identity
Entity Key: True
Nullable: False
Type: Guid
Validation Required: True
I use the POCO template.
When I now try to add a new object with a set ID, I get an error that the field ID has no default value although the value is set.
Code: Select all
var obj = new MyClass();
obj.ID = Guid.NewGuid();
context.MyClasses.AddObject(obj);
context.SaveChanges(); <--- Exception thrown
Thanks
Daniel