/// <summary>Creates a primary key predicate to be used in a Where() clause in a Linq query on an IEnumerable in-memory set of entity instances to retrieve the original entity instance the specified <see cref="dto"/> object was projected from.</summary> /// <param name="dto">The dto object for which the primary key predicate has to be created for.</param> /// <returns>ready to use func</returns> public static Func <NWService.Dal.EntityClasses.OrderEntity, bool> CreateInMemoryPkPredicate(NWService.Dtos.DtoClasses.Order dto) { return(p__0 => p__0.OrderId == dto.OrderId); }
/// <summary>Updates the specified NWService.Dal.EntityClasses.OrderEntity entity with the values stored in the dto object specified</summary> /// <param name="toUpdate">the entity instance to update.</param> /// <param name="dto">The dto object containing the source values.</param> /// <remarks>The PK field of toUpdate is set only if it's not marked as readonly.</remarks> public static void UpdateFromOrder(this NWService.Dal.EntityClasses.OrderEntity toUpdate, NWService.Dtos.DtoClasses.Order dto) { if ((toUpdate == null) || (dto == null)) { return; } toUpdate.CustomerId = dto.CustomerId; toUpdate.EmployeeId = dto.EmployeeId; toUpdate.Freight = dto.Freight; toUpdate.OrderDate = dto.OrderDate; toUpdate.RequiredDate = dto.RequiredDate; toUpdate.ShipAddress = dto.ShipAddress; toUpdate.ShipCity = dto.ShipCity; toUpdate.ShipCountry = dto.ShipCountry; toUpdate.ShipName = dto.ShipName; toUpdate.ShippedDate = dto.ShippedDate; toUpdate.ShipPostalCode = dto.ShipPostalCode; toUpdate.ShipRegion = dto.ShipRegion; toUpdate.ShipVia = dto.ShipVia; }
/// <summary>Creates a primary key predicate to be used in a Where() clause in a Linq query which is executed on the database to fetch the original entity instance the specified <see cref="dto"/> object was projected from.</summary> /// <param name="dto">The dto object for which the primary key predicate has to be created for.</param> /// <returns>ready to use expression</returns> public static System.Linq.Expressions.Expression <Func <NWService.Dal.EntityClasses.OrderEntity, bool> > CreatePkPredicate(NWService.Dtos.DtoClasses.Order dto) { return(p__0 => p__0.OrderId == dto.OrderId); }