A tiny bit better (warning, GMail syntax checked)
1) Base "should" be at the end if type names
2) Get implies single entity, Find implies collection
3) Make sure you have a base interface for Entities if you might need
polymorphic collections (like Managers and Employees in a single
query) that returns only the base class.
4) Return IList<T> not List<T> so you can swap the returned type easily.
5) You don't need to provide both the provider interface and entity
type, it can infer the provider type.
interface IEntityProviderBase
{
EntityBase Get(int id);
IList<EntityBase> FindAll();
}
interface IEntityProvider<T> : IEntityProviderBase
where T: BaseEntity
{
public new T Get(int id);
public new List<T> FindAll();
}
interface IUserProvider : IEntityProvider<User>
{
User FindByLastName(string lastName);
}
class ProviderFactory<T>
where T: EntityBase
{
public static IEntityProvider<T> CreateProvider(){}
}
IUserProvider x = ProviderFactory<IUserProvider>.CreateProvider();
User y = x.FindBy...
IList<User> yy = x.FindAll();
--
"It's not the quality of journalism that is sinking e-media companies, it
the quality." Thom Calandra - CBS Marketwatch
Marc C. Brooks
http://musingmarc.blogspot.com
===================================
This list is hosted by DevelopMentor� http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com