I’m used to creating the UI, BLL, DAL by hand (some times I’ve used LINQ-to-SQL or SubSonic for the DAL). I’ve done several small projects using MVC since its release.
On these projects I’ve still continued to write a BLL and DAL by hand and then incorporate those into the MVC’s models/controllers. I’m looking to optimize my time on projects this seems like overkill and a potential waste of time.
Question
Would it be acceptable to roll a DAL such as SubSonic and directly use it in the Models/Controllers of my MVC web app? Now the models & controllers would act as the BLL. I just see this as a major timesaver to not have to worry about another tier.
UPDATE:
I just wanted to add that my concern isn’t really with the DAL (I frequently use SubSonic and NH) but rather focus on the BLL. Sorry for the confusion.
MVC has no or little connection to the n-tier architecture. It belongs to the UI layer and serves to process interaction with the user. How you structure the rest of your application is… let’s use the word orthogonal to you using MVC or not.
Business logic layer stays if you had it.
Data access layer stays if you had it.
Controllers should not be used to implement business logic. It’s basically a routing layer to decide what action to invoke, what route to redirect to. A general recommendation is to keep it thin and have it take a decision on the basis of the route data and a few business logic calls.
Also models do not equal business objects. Models are a pack of data to be displayed by a view, likely to contain some auxiliary data not related to a business entity.
You can use an ORM and replace the data access layer with it. Depends on the ORM how you can integrate it. With EF you can use the entities directly as business objects.