How to use Entity Framework 4 to copy data between two database
Posted on 2010-08-12
I have to copy records from DB A on server A to DB B on server B. The schema of both databases is almost identical with little difference in table and column names (each db has it's own prefix with table names). How can I do the following:
1. Use single set of entity classes for both databases.
2. Read data from db A and insert it to Db B maintaining the foreign key relationship. Please note each db has it own foreign key I.e. If it wer product record in db A the foreign key for category 'beverages' could be different than in db B.
3. Read data from db A and update data in db B. It seems challenging as both DBs have differnet auto generated primary key for same record although there are other unique keys abailabe which should be used to updat the data.
Any help in right direction is highly appreciated.