Inserting Guid into Binary(16) field

Inserting Guid into Binary(16) field

Postby mosessaur » Fri 05 Jun 2009 14:36

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?!
Posts: 1
Joined: Fri 05 Jun 2009 13:18

Postby Shalex » Tue 09 Jun 2009 11:22

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();
Devart Team
Posts: 7343
Joined: Thu 14 Aug 2008 12:44

Return to dotConnect for MySQL