Normally IsNew is not required to be implemented because the record is detected as new if the primary key is the default value. If you have a table that has a composite key, IsNew is useful for inserting new records. If there is an IsNew property and it is true, OR if the primary key is the default value, then the object will be inserted.
public class SalesPeople
{
CompositeKey] public string Region { get; set; }[
[CompositeKey]
public string Salesman { get; set; }
public decimal Sales { get; set; }
public bool IsNew { get; set; }
public bool IsDirty { get; set; }
public SalesPeople()
{
IsNew = true;
IsDirty = false;
}
}
//Get the current instance of the helper
IDataHelper db = DataHelper.SessionFactory();
SalesPeople salesPerson = new SalesPeople();
salesPerson.IsNew = true;
salesPerson.Region = "Northwest";
salesPerson.Salesman = "Buckaroo Banzai";
db.Save(salesPerson);