link

I'm starting a new web app, and I want to build it with flexibility and maintainability in mind.

In the past I would just create classes that mapped 1:1 with database tables, and then created another class which was kind of a factory that would perform all the CRUD on the class.

I am thinking of this approach now:

1. create an interface for everything.
2. create the implementation of the class
3. any instantiation of the class should be done via something like ninject.

So the layout of my vs.net project would look like:

/AcmeLibrary/

/AcmeLibrary/Components/User.cs
/AcmeLibrary/Components/UserManager.cs (CRUD)
/AcmeLibrary/Interfaces/IUser.cs
/AcmeLibrary/Interfaces/IUserManager.cs

So I would instantiate a user object like:

IUser user = NInject.Get<User>();

Is this a good approach? I want to be able to unit test also.