Vignesh
Vignesh

Reputation: 1518

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

Upvotes: 5

Views: 35828

Answers (3)

Prageeth godage
Prageeth godage

Reputation: 4554

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.

Upvotes: 3

backtrack
backtrack

Reputation: 8144

Keep the data Access Layer as it is but through controller call the DataAccessLayer methods Because the view directly calls the corresponding controller. From that controller you can access the Data Access Layer but create the Class (models ) in the model Folder

Upvotes: 0

Nithesh Narayanan
Nithesh Narayanan

Reputation: 11765

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.

Upvotes: 2

Related Questions