开发者

Architecture for new ASP.NET web application

开发者 https://www.devze.com 2022-12-31 10:44 出处:网络
I\'m maintaining an application which currently is just a web service (built with WCF) and a database backend. The web service is built in layers with a linq-to-sql data access part with core function

I'm maintaining an application which currently is just a web service (built with WCF) and a database backend. The web service is built in layers with a linq-to-sql data access part with core functionality in an own assembly and on top of that the web service assembly which contains the WCF code. The core ass开发者_开发技巧embly also handles all business logic rules (very few actually).

The customer now wants a Web interface for the application instead of just accessing it through other applications which are consuming the web service. I'm quite lost on modern web application design, so I would like some advice on what architecture and frameworks to use for the web application. The web application will be using the same core assembly with business rules and the linq-to-sql data access layer as the web service.

Some concepts I've thought about are:

  • ASP.NET MVC (or MVC-2)
  • Webforms
  • AJAX controls - possibly leting the AJAX controls access the existing web service through JSON.

Are there any more concepts I should look into? Which one is the best for a fresh project?

The development tools are Visual Studio 2008 Team Edition for Developers targeting .NET 3.5. An upgrade to Visual Studio 2010 Premium (or maybe even Ultimate) is possible if it gives any benefits.


Definitely dig into ASP.NET MVC2.

All of our projects are now being developed using ASP.NET MVC2. It's not just highly scalable. It's highly testable as well. Which leads to way better maintainable apps in the long term.

WebForms vs. MVC2 points - (speaking out of experience):

Scalability:

In our company we had a lot of applications using WebForms which then were updated and changed by us as needed by our customers.

I think your customer will be requesting more changes on the application in near future. Making calls to other services, and maybe you'll have to rework parts of the final product to match their wishes.

And with the upcoming Cloud Computing and the Windows Azure platform you'll probably need to keep up with your code.

ASP.NET MVC absolutely supports the concept of being able to scale up your application any time you want.

I remember one of our customers walking up on me asking me for an extension for their app (they have a member management system) and the feature would contain something like a link to export the current view as a csv file so they could do office stuff with it (mostly serial letters).

It wasn't really a big problem setting that feature up. (took around 2 hours including writing tests) - let's go to tests:


Testability:

Using WebForms we didn't really have much interest writing tests because it was a pure pain to do so. I remember writing some tests to have at least some proofs but let's drop that topic.. (:p)

We had tests for our custom classes but we couldn't really test all the EventHandlers within the WebForms.

Our CodeBase is way cleaner and saver to use thanks to this testable environment. I just check out some of the code, modify it, run all the tests and: Oh, it broke on strange behavior! - Let's fix that again. Earlier, I remember sitting with my co-worker debugging and trying to find those bugs for hours.

With ASP.NET MVC2 we are now lacking tests! We ask all kinds of people (even the non-Web ones) to provide test-cases we could feed into our TestSuite.

And yeah, there are some AJAX-Controls too:


AJAXability:

You asked about AJAX Controls and in conjunction with ASP.NET MVC I highly recommend you to check out Telerik ASP.NET MVC UI Controls.

If that isn't something for you, we also make extensive use of jQuery and jQuery UI

With ASP.NET MVC and the HTML Views, those libraries aren't just a pleasure to use, they just look amazingly beautiful.

There is no random-html-tag-id-value autogeneration anymore!

But what I like most is: You can finally really re-use your code again.


There is so much more to those frameworks than just that, there is the T4 templating system. Auto-Scaffolding for your ViewModels / DomainModels with the Html.EditorFor() method and of course there is a great and easy way to use the IoC and DI paradigms.

Assuming that you have asked the question with mostly .NET Framework related tags, you'll probably stick with it.

Just to keep the post complete, there are also other frameworks that are just as good (or even better):

  • Ruby on Rails
  • Django
  • CakePHP

And many many more!


There's also DynamicData which may be appropriate if you need simple CRUD access to your data.


The Web Service Software Factory (WSSF) might come in handy in your situation.

This will allow you to define your contracts (XML entity returned (if XML you choose), etc.) while designing the server/client communication using WCF (or standard Web Service communication protocol).

WSSF favors either ASP.NET MVC or ASP.NET MVP. A simple example of the MVP architecture is shown here, plus this article.

As for me, I often come with a hybrid-like architecture using a bit of both MVC and MVP, as both have different strong points which combined together fill each other's improvement points.


I'd also recommend looking into Silverlight.

http://www.silverlight.net/learn/


Just my opinion to use MVC on Client sites and WebForms inside administration pages(site)

0

精彩评论

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