This project is read-only.

Generic repository and modelstate

Jun 6, 2012 at 1:22 PM


I have two questions.

1) the repository & repository interface design works well in the nerddinners sample app. But what about a real world app with a dozen of model classes with their respective repositories?

Can the methods be defined in a generic way so that each repository implements a single generic interface, for example:

public interface IBaseRepository<T>
T get(int id);
void insert(T obj);
void delete(T obj);
void save();


2) I noticed the absence of the ModelState's AddModelErrors extention method in the MVC 2 implementation. Is this replaced by usage of validation annotations? Does the MVC 1 IsValid & GetRuleValidations approach still work in an MVC 2 project?

Thank you