When is it handy to have a business layer in your mvc web application? Why do calls from the controller go straight to the dataaccess layer?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This could come handy if you have some existing or complex business logic you would like to reuse. Obviously this doesn’t mean that you should always have a business layer in each application. It would depend on the specific requirements of the application and answering this question without more details about your scenario would be subjective.
So if you want an objective answer please provide an objective scenario, otherwise we are just chattering here without being constructive.
No idea, it would be bad practice IMHO as it would make your controllers tightly coupled to your database and as a consequence difficult to unit test. What if tomorrow you decide to switch to the could? Would you like to modify your controllers? I would recommend you to make the different layers of your application as weakly coupled as possible by always working with abstractions (abstract classes/interfaces).