NMemory enables to execute SQL-like update and delete commands. Just import the NMemory.Linq namespace and use the Delete or Update extension methods on the queries.

The following example shows how to use the Update method, it updates the data of older people in the database: concats "(senior)" to the name, and changes the group membership.

db.People
    .Where(p => p.BirthDay.Year < 1950)
    .Update(p => new Person { 
        Name = p.Name + " (senior)", 
        GroupId = 2 });

Using the Delete method is even easier, this example removes the older people from the database.

db.People
    .Where(p => p.BirthDay.Year < 1950)
    .Delete();

Last edited Jun 10, 2012 at 6:34 PM by tamasflamich, version 3

Comments

No comments yet.