SynchroniseWithDataContext and inherited entities

Jul 29, 2008 at 2:29 PM
Edited Jul 29, 2008 at 2:33 PM

With inherited entities, i have an exception when call SynchroniseWithDataContext : Could not retrieve a Table for inheritance subtype <InheritedEntityType>, try Table of <BaseEntityType> instead.
I suggest to replace entity.GetType() by a call to a new method entity.GetbaseEntityType()  to find the table in SynchroniseWithDataContext method.

public
Type GetEntityBaseType() 

     
Type baseType = this.GetType(); 
     
while (!(baseType.BaseType == typeof(EntityBase))) 
    {
        baseType = baseType.BaseType;
    }
    return baseType;
}

 

 

 

 

Coordinator
Aug 1, 2008 at 9:41 PM
Hi there,

Sorry for the late reply.

I'll take a look at this and get back to you soon.

Cheers

Matt
Coordinator
Aug 8, 2008 at 4:37 AM
Ok, I've had a look at it and come up with a solution very similar to yours.

I've added it the latest checking, please let me know if I've missed something.

Cheers

Matt.