Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to create a Data Access Layer in the MVC Project

I have created an empty MVC project, in that I need to access database i am not using any entity framework ,just directly using codes. Here I have attached the snapshot of my project architecture in that u can see Data Access Layer folder, is it a good way to use the Data Access Layer in the same project or do we need to create a separate project for data access layer.

Project Architecture Snapshot:

My Project Architecture Snapshot

like image 504
Vignesh Avatar asked Oct 04 '22 09:10

Vignesh


2 Answers

It is up to the architecture you choose. Basically in your MVC project your model communicate with the data.

If you are using ADO i would like to suggest move the model into separate class library also DataAccess into seperate class library which we are using in 3-tier models.

Hence you can call data access from business logic which are separated from the mvc project.

Some thing like this

enter image description here

In the model you can use the BLL

Or you can add the App_Data folder and write a data access helper class and write the business logic in model itself. I would like to suggest separate it using the first method.

like image 82
Nithesh Narayanan Avatar answered Oct 08 '22 20:10

Nithesh Narayanan


I am also face similar probelm.see following is help for you. http://www.codeproject.com/Articles/70061/Architecture-Guide-ASP-NET-MVC-Framework-N-tier-En

I use repository pattern and unit of work.But there you are redundancy coding via layers.the above link contain bit old one see is that help to you. don't forget to make a commet on this.thank you.

like image 2
Prageeth godage Avatar answered Oct 08 '22 21:10

Prageeth godage