in my Winform Project, i have a simple detail form where we can add new, edit and save persistent Object, until here everything is fine.
Edit Controls are binded by code in the from constructor, and the first new object is also passed by the form constructor when created at first time
Now i would like to implement a Save and New method, but without success
I tried this, assuming that tbVehicule is the object class, theVehicule is my persistent Object and frmVehicule my detail form
// Form Constructor
public frmVehicule(tbVehicule theVehicule)
: this() {
this.theVehicule = theVehicule;
// method to bind all controls
bindingFields();
}
// Save and new method
private void barBtnSaveNew_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
{
this.Validate();
theVehicule.Save();
theVehicule = new tbVehicule(theVehicule.Session);
}
the process should be similar to other ORM like EF or Hibernate