views:

416

answers:

1

In this code:

DataContext dx = new DataContext( string.Empty );
MockLinqDataObject foo = new MockLinqDataObject();
dx.GetTable( foo.GetType() ).Attach( foo );

foo.PK = Guid.NewGuid();

// always returns empty array
ModifiedMemberInfo[] arr_Result = dx.GetTable( foo.GetType() ).GetModifiedMembers( foo );
bool isOk = ( arr_Result.Length == 1 );
return isOk;

is always returned empty array from "GetModifiedMembers(object)", but "dx.GetChangeSet().Updates.Contains( foo )" returns true. What I do wrong?

A: 

I know this isn't an answer but I haven't been able to replicate your issue.

Using the following code in a console application I get an array of length 1:

        testdbDataContext db = new testdbDataContext();
        Address a = new Address();
        db.GetTable(a.GetType()).Attach(a);
        a.Address1 = "simple change";

        var result = db.GetTable(a.GetType()).GetModifiedMembers(a);
        Console.WriteLine(result.Length);
        Console.ReadKey();

Console output is '1'. Try modifying another property on the foo object and see if your result differs.

Andrew Myhre