jeudi 2 juillet 2015

How much repository interfaces must created in Repository Pattern?

Assume we have following classes:

public class User
{
    //User Definitions Goes Here
}

public class Product
{
    //Product Definitions Goes Here
}

public class Order
{
    //Order Definitions Goes Here
}

Having above models, Should I Create only one repository like:

public interface IRepository
{
    //IRepository Definition Goes Here
}

Or it is better to have multiple repository:

public interface IUserRepository
{
    //IUserRepository Definition Goes Here
}

public interface IProductRepository
{
    //IProductRepository Definition Goes Here
}

public interface IOrderRepository
{
    //IOrderRepository Definition Goes Here
}

And what is each pros and cons?

Aucun commentaire:

Enregistrer un commentaire