public static ISpecification<Place> ByAddress(Address address) { Specification<Place> specification = new TrueSpecification<Place>(); if (address != null) { var stspec = new DirectSpecification<Place>( p => p.Address.Street.ToLower().Contains( address.Street.ToLower() ) ); var dtspec = new DirectSpecification<Place>( p => p.Address.District.ToLower().Contains( address.District.ToLower() ) ); var zpspec = new DirectSpecification<Place>( p => p.Address.ZipCode == address.ZipCode ); specification &= stspec || dtspec || zpspec; } return specification; }
public void ChangeAddress(Address newAddress) { if (newAddress == null || newAddress.IsTransient()) throw new ArgumentException("newAddress"); AddressId = newAddress.Id; Address = newAddress; }