a problem crossed my way more than once.
I'm using a Linq DataClass in a DataContext. After a loader ran through this, its sometime needed to move an Object to another DataClass with the same structure.
So f.e. Products and ProductsHistory, each time after a change in Products, the actual Product is taken an put into ProductsHistory.
How can I simplify this action, without writing an conversion function like that:
private static ProductHistory convert(Product p)
{
ProductHistory ph = new ProductHistory();
ph.Attr1 = p.Attr1;
ph.Attr2 = p.Attr2;
//...and hundreds like this on...
return ph;
}
I do not want to execute a SQL Query like DataContexts would support.
Any hint would be nice,
thanks in advance,
Harry