views:

55

answers:

2

Hi all, I have the following situation: I have class User with the follwing properies :

public class User
{
 string user name ;
 List <Contact> contacts ;
 List <BookMark> book marks;
 .
 .
 .
}

I have the same class in a different namespace , with some different properties . BWT , it's the same situation of it's classes (Contact) and (BookMark). I need to make a deep copy of the same properties from the two classes .

Actually , I arrive to this situation by having an Entity Framework edmx file . I created the first database (SQL server 2008) from this model . And copied he same edmx file to another project and created the database with SQL CE db. Now I get the first data model objects by WCF service and need to persist them in the local database in my application . The objects are the same but there are some changs because of the modeling issue with a different databse. Do you have any workarround about this assue.

Thanks in advance ...

A: 

Try automapper http://automapper.codeplex.com/

Raj Kaimal
A: 

I think I'd write my own deepcopy method that could use reflection to inspect what fields of object to copy.

Kamil Szot