Hi Experts, I have two tables in a LINQ to SQL dbml file. I am trying to get all the changes submitted to context, which I can get by using
var myOtherContext;
var changes = context.GetChangeSet();
foreach (var change in changes)
{
Type t = change.GetType();
if (change is Product )
{
myOtherContext.GetTable<Product>().InsertOnSubmit((Product) change);
}
if (change is Supplier)
{
myOtherContext.GetTable<Supplier>().InsertOnSubmit((Supplier)change);
}
}
Basically, I am copying all the changes that happened on one context to the other context (myOtherContext). I don't want to use an if statement to check the type of change. Is there any way I can write:
myOtherContext.GetTable<typeof(change)>().InsertOnSubmit((typeof(change) change);
Your help will be appreciated.
Regards, Parminder