/// <summary> /// Updates the entity with the values contained within the surrogate. /// </summary> /// <param name="entity">The entity.</param> public void BindObjectInstance(Address entity) { if (entity.Row.RowState == DataRowState.Added) { entity.Address1 = Address1; entity.Address2 = Address2; entity.City = City; entity.State = State; entity.Zip = Zip; entity.Zip4 = Zip4; } else { if (_address1HasBeenUpdated) { entity.Address1 = Address1; } if (_address2HasBeenUpdated) { entity.Address2 = Address2; } if (_cityHasBeenUpdated) { entity.City = City; } if (_stateHasBeenUpdated) { entity.State = State; } if (_zipHasBeenUpdated) { entity.Zip = Zip; } if (_zip4HasBeenUpdated) { entity.Zip4 = Zip4; } } }
/// <summary>Constructor for assembling a surrogate from an entity object.</summary> /// <param name="entity">The Entity Object.</param> public AddressSurrogate(Address entity) : base(entity) { _sb = new StringBuilder(); }
/// <summary> /// Initializes a new instance of the <see cref="AddressSurrogateBase"/> class. /// </summary> /// <param name="entity">The entity.</param> public AddressSurrogateBase(Address entity) { AddressID = entity.AddressID; Address1 = entity.Address1; Address2 = entity.Address2; City = entity.City; State = entity.State; Zip = entity.Zip; Zip4 = entity.Zip4; }