Field-driven design case: Tiny Library: Introduction

Source: Internet
Author: User
Tags create database schema

According to the requirements of many netizens, I recently took the time to use ASP. net MVC + WCF + Entity Framework makes a case. This case is based on the business background of library book management, reader borrowing, and returning books, and guided by the field-driven design, the whole process of using Microsoft technology is expected to provide practical reference for Microsoft technology enthusiasts and scholars of field-driven design.

The business logic selected in this case is very simple, so I chose "tiny library" for the project name ", in the next chapter, I will detail the business logic, model design, and system architecture of this case.

Download case

I was planning to release the project to codeplex for your convenience.CodeUpdate and maintenance, but for some reason, I cannot connect to the codeplex SVN/TFS service in my network environment. Therefore, I can only publish the case in the form of a compressed package.Source codeI hope you will understand and wait for the opportunity to update it to codeplex before notifying you.

[Click here to download the source code of the case]

 

System Requirements

    • Microsoft Visual maxcompute 2010
    • Microsoft patterns & Practices 5.0 (v5.0.414.0, runtime v2.0.50727. Download and install it on the Microsoft official website)
    • Microsoft ASP. net mvc 2
    • Microsoft Entity Framework (note: the version that comes with Visual Studio 2010, not the latest Feature Pack CTP Version)
    • Microsoft SQL express 2008 SP1
    • Apworks application development framework

Please install the above software and components before opening the case solution!

(Apworks application development framework is a domain-driven application developed by myself .)ProgramThe Development Framework provides support for aggregate root, repositories, specifications, and transaction context, which can basically meet the needs of application development for small and medium-sized field-driven projects based on Microsoft. NET technology. Currently, this framework project is further implementing a framework based on the cqrs architecture model. To save time, this seriesArticleApworks application development framework is not described too much. This framework is still under construction, so readers should never use it in their own system development to avoid danger! For source code for apworks application development framework and more information, visit the project site: http://apworks.codeplex.com. The tiny library package contains an apworks version that can be used by tiny library. Therefore, readers do not need to download and compile the source code on the apworks site. Of course, if you want to know how to implement apworks, you can use the site above to view the source code of apworks.

 

Installation and deployment

  1. Create a database
    Use the Server Explorer function provided by Microsoft Visual Studio 2010, right-click data connections, and select the create new SQL Server database option. The create new SQL Server database dialog box appears, in the server name dialog box, enter (local) \ sqlexpress, tinylibrarydb in new database name, and then click OK.
  2. Create database schema
    Use Microsoft Visual Studio 2010 to open the tinylibrary solution. locate tinylibrary under the domain project node. edmx. SQL script file. Open the script file. In the SQL editor area, right-click the file and select connection | connect. The connect to database engine dialog box is displayed. Select sqlexpress from server and click OK.

    Right-click the SQL editor area again, select the Execute SQL option, and execute the SQL script to create the database schema.
  3. Create demo data)
    In the same way as above, open the tinylibrary. DemoData. SQL script under the tinylibrary. Domain project and execute
  4. Port 3722
    The WCF Service of tiny library uses port 3722 as the fixed port of its service. Therefore, in this case, make sure that the port is not occupied by other applications.


Running case

    1. On the Solution Explorer of Microsoft Visual Studio 2010, right-click tinylibrary solution and select rebuild solution to recompile the solution.
    2. In tinylibrary. under services, select tinylibraryservice. SVC, right-click, and select View in browser. asp is automatically enabled. net Development Server, which occupies port 3722 and opens the page of the WCF Service. Close the page of the WCF Service, leaving only the ASP. NET development server
    3. Right-click the tinylibrary. webapp project, select the set as startup project option, and press Ctrl + F5 or debug | start without debugging in Microsoft Visual Studio to start the application.
    4. After the application is started, you can see the main interface as follows:
       

 

Logon account

For testing purposes, tiny Library provides three user accounts by default: daxnet, acqy, and James. The username and password are as follows:

    1. Login Name: daxnet; Password: daxnet@live.com
    2. Login Name: acqy; Name: Sunny Chen; Password: acqy@163.com
    3. Login Name: James; Password: james@tinylibrary.com

 

Additional instructions

Time is limited. This case is only a case of domain-driven design practices based on Microsoft. NET technology. Therefore, the following content is not included in this case:

    1. It is based on the technical practices of AOP and Policy injection. This includes Exception Handling, data verification, and system logs.
    2. Book maintenance page based on user/role Verification
    3. Advanced ASP. net mvc applications
    4. Exception capture and display of WCF
    5. Unit Test
    6. Other technical details

If you are interested, you can expand the source code of this case to implement a complete library management application.

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.