Project Description

The project consists of adding the functionality of multiple updates and deletes in a container
entities in the Entity Framework, using lambda expression.

In case of problems, suggestions or interest in helping the project, please contact us.

Example Update

Simple update

using System.EntityFramework.Extensions.ObjectQueryExtensions;
public class Teste
{
   public static void Teste()
   {
        this.Devices.Update(o => new Device() { LastOrderRequest = DateTime.Now, Description = "teste" }, o => o.Id == 1);
   }
}

Concatenating properties

using System.EntityFramework.Extensions.ObjectQueryExtensions;
public class Teste
{
   public static void Teste()
   {
        this.Container.Devices.Update(o => new Device() { LastOrderRequest = DateTime.Now, Description = o.Description + "teste" }, o => o.Id == 1);
   }
}

Multiple commands running in transaction

using System.EntityFramework.Extensions.ObjectQueryExtensions;
public class Teste
{
   public static void Teste()
   {
        this.Container.Devices.Update(
              new CommandExpression<Device>(o => new Device() { LastOrderRequest = DateTime.Now, Description = o.Description + "teste" }, o => o.Id == 1),
              new CommandExpression<Device>(o => new Device() { Description = o.Description + "teste2" }, o => o.Id == 2)
        );
   }
}

Example Delete

Simple Delete

using System.EntityFramework.Extensions.ObjectQueryExtensions;
public class Teste
{
   public static void Teste()
   {
        this.Container.Devices.Delete(o => o.Id == 1);
   }
}

Multiple commands running in transaction

using System.EntityFramework.Extensions.ObjectQueryExtensions;
public class Teste
{
   public static void Teste()
   {
        this.Container.Devices.Delete(
             o => o.Id == 1,
             o => o.Id == 2
        );
   }
}

Last edited Sep 20, 2010 at 6:37 PM by thiago_amarante, version 10