While I'm a died in the wool stored proc author, I'm intriqued by pipes & filters, I do however have one thought: If you have a table with several foreign keys and you're likely to want to filter by all of them, wouldn't it make sense to have your service consolidate these filtering methods? Imagine an address class and an address filter with filters for city, County, state, etc. I used an enum and a switch statement to keep the clutter down on my Service:
public IList<Address> GetAddressCollectionFilterWithKeyField(Address.FilterKey KeyField, int id)
{
switch (KeyField)
{
case Address.FilterKey.AddressType:
return _repository.GetAddressCollection().WithAddressType(id).ToLi st();
case Address.FilterKey.District:
return _repository.GetAddressCollection().WithDistrict(id).ToList( );
case Address.FilterKey.City:
return _repository.GetAddressCollection().WithCity(id).ToList();
case Address.FilterKey.County:
return _repository.GetAddressCollection().WithCounty(id).ToList();
case Address.FilterKey.State:
return _repository.GetAddressCollection().WithState(id).ToList();
default:
return null;
}
}
any thoughts to potential weaknesses to this approach?