database syncing

Posts   
 
    
Answer
User
Posts: 363
Joined: 28-Jun-2004
# Posted on: 23-Oct-2005 02:35:30   

ok,

I have a database at location A which is the "master" and a database at location B. The databases will not be exactly the same. Approx half the tables will be identical. Now, tables at location B that are the same as at A will be readonly in the sense that no one at location b will be modifying those tables. But when something changes at A i need it propagated to B.

I dont really want to use replication. My plan was to use a web service and pass the entities. Now i want to use identity columns as PK in A which is no problem since the table at B are readonly. So a record gets created at A and propegates over a web service to B and its already unqiue.

So i generate two projects, one for each database. I can pass a single entiy over the webservices just fine. However it dumps when i try to pass an entitycollection due to the fact that when an enititycollection goes over the wire, it includes its type info and of course it cant find its type at location B since at location B its got a different type with the exact same data and fields.

Anyone got any ideas?

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 24-Oct-2005 16:15:18   

While replication might be the best scenario.

May I ask, are the repeated tables in database A & B have the same table name, fields names?

If so then passing entities between them should work as well as also passing collections.

if not then one of the 2 projects should use the others entities in transfering the data, and you should implement the entities-entities mapping.

Answer
User
Posts: 363
Joined: 28-Jun-2004
# Posted on: 24-Oct-2005 17:14:47   

Tables in A are exactly the same as in B only difference is the primary key in A is marked as identity.

The problem lies in the fact that when an entity collection is serialized it includes specific type information, such as the class and assembly name. So when it deserializes it, of course that type is not available.

It appears like my only solution is to do entity-entity mapping rage I could write a template to do that though smile

Paul.Lewis
User
Posts: 147
Joined: 22-Aug-2005
# Posted on: 26-Oct-2005 04:49:13   

Answer wrote:

It appears like my only solution is to do entity-entity mapping rage I could write a template to do that though smile

My first thought would be to pass the entity attribute data as XML. In project B's webservice, use XSL to transform the A entity data attributes to match the B data attributes (primarily difference being the now-now-identity attribute).