Using Entity Framework, I have a Guid property that is supposed to map to Binary(16) field in database.
However appone SaveChanges it throughs an excption that Data is Too large to be saved on that field.
You can reproduce it by creating binary field binary(16) and in mapping specify that the property is Guid and in SSDL specify the the data type of this field is guid.
try to insert record using Entity Framework.
This issue never take place when the field type is Char(36) or varchar(36).
So I had to update my Database top change field type
Could you please advice if I did something wrong or anything is required or this is by design or bug?!
Cheers
Inserting Guid into Binary(16) field
We will fix this issue in the future builds. You may use either of two workarounds now. You can either use the char/varchar field in your database, or to create additional property in your partial table class that will wrap the GUID-binary conversion before the interoperation with the database.
Code: Select all
public Guid NewColumn {
get {
return new Guid(this.GUIDcolumn);
}
set {
this.GUIDcolumn = value.ToByteArray();
}
}