开发者

ASP.NET MVC 3 Architectural Direction [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago. 开发者_如何学运维

I am converting a classic ASP website to .NET. The application already has a back-end database with stored procedures for communicating with the DB. I want to use MVC3 and EF for this project.

My question is where is a good moderate example of these working in this environment?

I understand how the Model View Controller pattern works on basic examples. I went through the MVC Music Store demo and deployed it. However, I'm struggling with where I put certain code.

I'm looking for examples of how to tie into the existing DB with EF using the stored procedures and how the models should look. I'm also looking for where do I put code which is traditionally object methods.

If I have a Contact model, where does the code go to interact with that contact? And I'm not talking about the code that brings back the data you want to push to the View. Is that where Repositories come in? If so, where is a good tutorial on using repositories?

I appreciate the help. I realize this is a bunch of questions in one, but I don't think I'm the only one struggling with this either.


I'm sure there are plenty of tutorials available, which should help you get started. The 'Nerd dinner' example helped me getting started, as it gave good explanations of the repository pattern, and how to separate the project. You can find the current project here: http://nerddinner.codeplex.com/


I would definitely put the DAL in a separate project and I would definitely create an abstraction layer between the data access layer and the business logic layer of my application.

The Repository and Unit of Work Patterns are great for this purpose.

You can take a look at following articles. They are great for starting to create your data access layer :

Creating an Entity Framework Data Model for an ASP.NET MVC Application

http://www.asp.net/entity-framework/tutorials/creating-an-entity-framework-data-model-for-an-asp-net-mvc-application

Implementing the Repository and Unit of Work Patterns in an ASP.NET MVC Application

http://www.asp.net/entity-framework/tutorials/implementing-the-repository-and-unit-of-work-patterns-in-an-asp-net-mvc-application

These are from Getting Started with EF using MVC series on http://asp.net. You can find more useful articles there from the navigation panel on the left hand site there.


A good example of a client-side complex web application is Project Silk from Microsoft.

It contains a lot of design guidelines / documentation on MSDN website and a sample app with full source code you can download and play with.

I would recommend taking a look at it, especially if you have a complex UI to implement (jQuery, jQuery UI, client-side rendering, AJAX)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜