Best Structure for ASP.NET MVC Solution

前提是你 提交于 2019-11-28 18:24:42

the main guide that I use when I am setting up a project structure is to ensure that I can add some operationcontract attributes to the business logic layer, and then host it as a wcf service.

If i can do this, that means the business logic layer has isolated my data layer, and is interacting with its client only by passing simple structures and entities. the datalayer is completely hidden.

So my usual structure looks like:

Solution
    Business.Contracts (interfaces for bll layer in here)
    Business.Logic     (concrete implementations of contracts in here)
    Business.Entities  (Pocos that bll uses)
    Data.Contracts     (interfaces for dal)
    Data.Sql           (Concrete Sql implementation of contracts)
    Common.Enums       (Enums needed by all projects)
    FrontEnd           (Main mvc app)

So in this structure, my mvc project only ever deals with the business namespace and the common namespace.

When interacting with the entities however, I tend to use my own models in the mvc project to allow me to add annotations and front end specific functionality, then i provide implicit conversions for these models to be able to be used interchangeably with the business entities.

HTH

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!