5

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

1
  • Its always better to have the DAL in a seperate project other than your presentation layer. In future if you have a different database you dont have to make changes to your presentation layer. Just work on the DAL and you should be good to go. This is how I have followed in most of the projects. I ain't an architect, but sure have seen lot of people using the same layered architecture. Follow this link Commented Jul 30, 2013 at 5:05

3 Answers 3

3

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.

Sign up to request clarification or add additional context in comments.

Comments

2

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.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.