Telerik UI for Windows 8 XAML

Insetring entries in the database is implemented via the following method:

C# Copy imageCopy
public void Insert<PersistentType>(PersistentType objectToInsert)

- Inserts a new object of persisted type to database. The very first use of new entity object (aka persisted type) will enforce the context to create a corresponding table.


Using the example from the Getting Started section we can call the Insert method to add the following entries to the database:

C# Copy imageCopy
context.Insert<CarOwners>(new CarOwners() { OwnerID = 1, Name="Paul Grohe", Age=33, Alive = true, DateBorn=new DateTime(1980,7,23) });
context.Insert<Cars>(new Cars() { Model = "BMW", RegistrationNumber = "ZD123DF", YearOfModel = new DateTime(2010, 1, 1), OwnerFK = 1 });

See Also