/// <summary> /// Updates the entity with the values contained within the surrogate. /// </summary> /// <param name="entity">The entity.</param> public void BindObjectInstance(Customer entity) { if (entity.Row.RowState == DataRowState.Added) { entity.Name = Name; entity.MailingAddressID = MailingAddressID; entity.DeliveryAddressID = DeliveryAddressID; entity.StatusID = StatusID; entity.Remarks = Remarks; } else { if (_nameHasBeenUpdated) { entity.Name = Name; } if (_mailingaddressidHasBeenUpdated) { entity.MailingAddressID = MailingAddressID; } if (_deliveryaddressidHasBeenUpdated) { entity.DeliveryAddressID = DeliveryAddressID; } if (_statusidHasBeenUpdated) { entity.StatusID = StatusID; } if (_remarksHasBeenUpdated) { entity.Remarks = Remarks; } } }
/// <summary>Constructor for assembling a surrogate from an entity object.</summary> /// <param name="entity">The Entity Object.</param> public CustomerSurrogate(Customer entity) : base(entity) { _sb = new StringBuilder(); }
/// <summary> /// Initializes a new instance of the <see cref="CustomerSurrogateBase"/> class. /// </summary> /// <param name="entity">The entity.</param> public CustomerSurrogateBase(Customer entity) { CustomerID = entity.CustomerID; Name = entity.Name; MailingAddressID = entity.MailingAddressID; DeliveryAddressID = entity.DeliveryAddressID; StatusID = entity.StatusID; Remarks = entity.Remarks; }