Knight Data Access Layer
Saving Records
Basic Tasks C# > Saving Data > Saving Records


The Save Method will perform an insert, update or delete of a single object or a list of objects.  Here is how it determines what to do:

 

//Get the current instance of the helper

IDataHelper db = DataHelper.SessionFactory();

 

//Create a new Person to save to the database

Person currentPerson = new Person();

currentPerson.FirstName = "John";

currentPerson.LastName = "Smith";

 

//Save it to the database

db.Save(currentPerson);