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

Entire lists of objects can be saved.  The individual objects will be inserted, updated, or deleted.  See also Saving Records.

//Get the current instance of the helper

IDataHelper db = DataHelper.SessionFactory();

 

List<Person> list = new List<Person>();

list.Add(new Person {FirstName = "John", LastName = "Warfin"});

list.Add(new Person { FirstName = "John", LastName = "Ya Ya" });

list.Add(new Person { FirstName = "John", LastName = "Small Berries" });

db.Save(list);