Asp. Net large project practice (2)-new project and hierarchy (with source code)

Source: Internet
Author: User
  1. Prepare the development environment...
    Microsoft Visual maxcompute 2008
    Microsoft Visual Studio 2008 Sp1 (patch)
    Microsoft ASP. net mvc 1.0
  2. New Solution

    Create a blank solution HISDemo
  3. Create a solution folder

    For large projects, there are many modules and code. We can use the solution folder to reasonably manage the project, such:

    The lib folder is used to store the third-party dll referenced in the project (you can drag the DLL into it, so that when your project is bound to VSS, these DLL files can be obtained through VSS)
    Presentation (Presentation layer) is used to store Code related to the UI Layer.
    Because there are many project modules, we can divide them according to coarse-grained modules, such as Infrastructure (basic data setting module), hospitalization module, and outpatient registration module ....
    Note: The solution folder can be in Chinese. You can also divide the folder according to your habits and specific project situations. The general principle is to facilitate management and viewing.
  4. Basic hierarchy
    The time relationship diagram is rough, and some terms are not very standard. You can understand what it means,

    Data access layer Repositories: It mainly uses nhib.pdf to access the database, but may also access WebServices of other modules or systems, or use Linq to access some cached (in-memory) data, it is also possible to access XML, text files, and so on ....
    Business Domain Layer Core: At the core layer of the system, all business logic unrelated to data access should be put together here. In theory, the objects in the business field should be congested and their own business logic should be put together. However, some business logic involves objects in multiple business domains during design, and it is difficult for us to decide which specific business objects to put in, therefore, we have a Service layer for such business logic.
    Decoration layer Facade: Encapsulate data access interfaces, business logic of objects in the business field, and Service interfaces into Facade layer interfaces for the presentation layer UI or SOA layer to call, this layer should be noted that it is only a simple encapsulation, so that the UI Layer does not call too many layers of interfaces. This layer should not contain business logic.
    SOA Layer: Because the system has a large number of modules and the business needs to be decoupled among the major modules, this layer serves to call between various coarse-grained modules and to call other systems, for example, with the basic data management module and the outpatient registration module, the call between them must go through the SOA layer rather than the Facade layer, the transmitted object should be a new DTO data transmission object, instead of directly passing the business domain object, so that we can completely isolate various coarse-grained modules through the SOA layer. It may not be appropriate to name this layer SOA, so you don't have to go into it. The plan is to use WCF to flexibly configure communication methods.
    Presentation Layer Presentation: The Action of Asp.net MVC transmits data to ExtJs. Controler only needs to call the Facade interface.
    Public Class Library FrameWork: The public code of the entire project FrameWork is equivalent to the public class library. Maybe it is not appropriate to call the FrameWork.
  5. Create a hierarchical Project
    Create 3 class library projects

    Change the project namespace, such as Demo. HIS. infrastructure. core [company name]. [Project name]. [Big Module name]. [layered name]... it is important to have a reasonable namespace in a real project.
     
    Create two projects Demo. HIS. MVC (project type: Class Library) and DemoHisSite (project type: Asp.net MVC Web Appliction) in the Presentation folder ),

    Finally, create a Class Library Demo. HIS. FrameWork under the solution root directory as our public class library. The final project structure is as follows:
     

In this way, the project required by the entire system is established.

Source code: HISDemo-1.rar

    Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.