I need to insert a record into Payment table. I found two methods to do it
- AddObject
- InsertOnSubmit
What is the difference between the two? When to use what?
public void InsertEntity(DBML_Project.Payment payment)
{
//Insert the entity
MyDataContext.GetTable<DBML_Project.Payment>().InsertOnSubmit(payment);
}
public void InsertPayment(IPayment payment)
{
this.AddObject(payment.GetType().Name, payment);
}