problem about Table<T>.Attach(object, bool)

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
Posts: 1
Joined: Fri 13 Aug 2010 05:48

problem about Table<T>.Attach(object, bool)

Post by windwolf » Fri 13 Aug 2010 06:54

I have a table named "LinqTest", which has a Primary Key column called "ID" and a Version column called "VERSION_".

Code: Select all

  ID        VARCHAR2(50),
  NAME   VARCHAR2(20),
  AGE       NUMBER(38),
Step 1: I query one entity form a instance of DataContext.
Step 2: Modify the Name of the entity, while query form step 1.
Step 3: Attach the entity with another instance of DataContext by call Table.Attach(T, bool) with true as second parameter.
Step 4: SubmitChanges.

Code: Select all

Linqtest ent = null;
using (var ctx = new TestDataContext ())
                var linq = from c in ctx.GetTable()
                           where c.Id == "1607"
                           select c;
                ent = linq.FirstOrDefault();
ent.Name = "asdfasdf1";
using (var ctx2 = new TestDataContext ())
                ctx2.GetTable().Attach(ent, true);
                //var m = ctx2.GetTable().GetModifiedMembers(ent);
Then, throw a Exception.
Value of member 'Id' of an object of type 'Linqtest' changed.
A member defining the identity of the object cannot be changed.
Consider adding a new object with new identity and deleting the existing one instead.
Devart.Data.Linq.r.a(k A_0, ac A_1, Object A_2, Boolean A_3)
Devart.Data.Linq.y.a(r A_0, ac A_1, Boolean A_2)
Devart.Data.Linq.y.a(DataContext A_0, ConflictMode A_1)
Devart.Data.Linq.y.b(DataContext A_0, ConflictMode A_1)
Devart.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode)

So i check the modified members before submit. I find that, all fields except VERSION_ (include ID) are in the array of modified members.

The same code run well in Linq to SQL.

I guess that, there is something wrong in my code. or some bugs in the library.

I need a solution to solve this problem. thanks.

Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Tue 17 Aug 2010 12:03

Thank you for your report, we've reproduced the issue. We will inform you when it is fixed.

Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Thu 14 Oct 2010 15:50

We have fixed the problem. The fix is available in the new 5.70.180 build of dotConnect for Oracle. You can download it from
(the trial version only) or from Registered Users' Area (provided that you have an active subscription):

For more information about the improvements and fixes available in dotConnect for Oracle 5.70.180, please refer to

Post Reply