c#Repository pattern: One repository per subclass?

Posted by Alex on Stack Overflow See other posts from Stack Overflow or by Alex
Published on 2010-03-25T20:05:08Z Indexed on 2010/03/25 20:13 UTC
Read the original article Hit count: 788

Filed under:
|

I am wondering if you would create a repository for each subclass of a domain model. There are two classes for example:

public class Person
{
    public virtual String GivenName { set; get; }
    public virtual String FamilyName { set; get; }
    public virtual String EMailAdress { set; get; }    
}

public class Customer : Person
{
    public virtual DateTime RegistrationDate { get; set; }
    public virtual String Password { get; set; }        
}

Would you create both a PersonRepository and a CustomerRepository or just the PersonRepository which would also be able to execute Customer related queries?

© Stack Overflow or respective owner

Related posts about repository-pattern

Related posts about c#