Repository<T>, Syntactic Sugar and DDD
I am toying around with several ideas about the use of Repository<T> in DDD context. Right now it is theoretical because my current project has little need for DDD.
At the moment, I am using the static access for Repository<T> as my gateway for the repositories.
Another style may utilize a base controller as the place to put the repositories, like this:
The resulting code looks like this:
I really like the Repository<T> static accessor for stuff like tests that requires data setup, but I think that using it in the controllers may be over doing it. I like the second approach better, because the syntax doesn't have <T> all over the place, as well. It is also nicer from the point of view of syntax and it allows to replace the current IRepository<User> with IUserRepository very easily.
Thoughts?