English 中文(简体)
3-tiered web-service enabled architecture
原标题:

After reading tons of articles over the net about best-practise application-design and pattern I still cannot merge all the information together and map on my real-word-application...

I would like to have a 3-tiered application:

  • UI-Layer:
    A silverlight-application hosted within an ASP.net - Webapp

  • BusinessLogicLayer:
    WCF-Services / .NET RIA-Services running on a different Server

  • DataAccessLayer:Using an ORM like nHibernate oder Linq2Entities


The problem is, I don t know where to put my business objects, and where to fill them with data.

Should there be an another layer, containing all my business objects, so they could be used in all other 3 layers?
Or should I place them into my BLL and call nHibernate-Methods in the DAL - but then I would have a circular dependency between BLL and DAL? Isn t it "over-architectured" if I introduce "DataAccessObjects" inside the DAL and just copy all the properties into the BusinessObjects in the BLL?

Any help appreciated!

Best regards, Daniel Lang

问题回答

The business objects go in the Business layer. These objects are used by the UI layer, and call methods from the Data layer to populate themselves.

In general, objects in a layer only call methods in their own layer, or the one just below.

One of the motivations is to be able to replace one of the layers without changing the others. For example, there could be a different way to present the UI, which could use the same methods from the business layer. Or, perhaps the database could be changed, as long as the new data layer contains the same methods as the old one.

Well, because you re using WCF, you should have a "contract" that only contains interfaces and data classes. Those classes should be available to everyone else. No logic should be contained inside it.

Well, after reviewing the whole problem, I think the "best" solution is to use DependencyInjection or IversionOfControl to fill the business-objects with data in the DAL.

the business objects go in a Common layer,

I usually create a project and they contain, business objects, enums and whatever is common between server and client.

this project is referenced by all layers. It cant have references to any other project otherwise this would create a circular reference.





相关问题
IIS 6.0 hangs when serving a web-service

I am having issues with one of our web-services. It works fine on my development machine (win XP) whether I host it as a separate application or using cassini from Visual studio. Once I deploy on the ...

ASP.net web services

I am using a web service which sets the Thread.CurrentPrincipal object while logging in and soon later when another webmethod of the same web service accesses Thread.CurrentPrincipal, its different/...

Unity Container Disposing and XML Web Service

I am registering some wrapers over un-managed objects in container. How can I dispose of them at the end of the container s lifetime? Please bear in mind I have an XML Web service.

SharePoint : web service permission error

I have a sharepoint site, and I am calling a standard sharepoint web service. I create the web service request like this : wsDws.Url = this.SiteAddress + @"/_vti_bin/Dws.asmx"; When I use ...

热门标签