. NET Core cross-platform: use. NET Core to develop a central mall, core.net

Source: Internet
Author: User
Tags free cdn

. NET Core cross-platform: use. NET Core to develop a central mall, core.net
1. Basic Introduction to. NET CoreA As. NET developers, In the past development, the projects we developed were basically deployed on windows servers, however, on windows servers, some of the most popular solutions for traffic volume are first available on linux before migration to windows, and there is no longer a level of efficiency processing. Once let. NET developers are very helpless and have to follow it. Over time, third-party companies developed. NET can rely on the cross-platform technology Mono, And we can simply implement cross-platform for the programs it develops. I have written a blog about how Mono deploys ASP. NET cross-platform technology ( http://www.cnblogs.com/hanyinglong/p/5456757.html ) Later, Microsoft changed its new CEO (Nadella), and the entire company of Microsoft began to transform to a service-oriented company, instead of being stuck in the previous step, his appearance also promoted cross-platform implementation. After Microsoft acquired Mono from a third-party company, Microsoft launched ASP. NET Core cross-platform technology, which conforms to the current general trend of open source, also makes most programmers full of expectations and expectations for this technology, the so-called work to do its best, do not have to profit first, the following is a simple example of ASP. NET Core. B ASP. NET Core is a new open-source and cross-platform framework for building the Internet architecture, ASP.. NET Core applications can run on. NET FrameWork.. net mvc and WebAPI are restructured so that they can be developed and run across platforms on windows, Mac, and Linux.. NET Core reference. C. NET Core has made some changes to the cross-platform architecture. We can feel that it is not dependent on System. web. dll is implemented based on the granular package. json to see its reference (in the latest version. the project. json is converted to msbuild.) After the stable version is released, I will also learn about it and upgrade the project. D. NET Core Official Website: https://www.microsoft.com/net/core E. NET Core, we also began to learn how to use it. NET Core development Web reference, of course, our development is just to learn ASP. NET Core and go to the development mall, we learned a lot in the development of this mall, here, I sincerely thank my friends for developing, testing, and improving together (development is me and Bobo and a Wei, testing Juntao, front-end KeyBaby (not professional )). Our website address is as follows: http://www.chuxinm.com/ Next, I will briefly introduce the things and architecture used in this project. If I have the opportunity, I will continue to elaborate on the technical points in this project.2. Framework Structure of chuxinyuan mall projectA ASP. NET Core is a completely new framework, which is created using Visual Studio 2015. as shown in. NET Core project, after an empty project architecture is selected during creation, the project architecture is developed based on the empty project architecture.

  

B. After the project is created, we find that the dependency of the project folder is only a little different from that of the previous one, as shown below: Everyone can basically understand the information under these folders ,, the following is a brief introduction to the system architecture. B .1 The interfaces and implementation class libraries in the Repository solution folder are warehousing. The main function is to encapsulate the basic operations (add, delete, modify, and query) of the database and implement the extended Operation database. B .2 The interfaces and implementation class libraries in the Service solution folder serve as services. The main function is to encapsulate business functions. All business functions are at this layer, operations cannot be processed in the warehouse or controller. For more convenient open interfaces in the future, see B .3 Pls. the Entity class library is an object class library. All the class libraries and ing files of the generated database are under this class library to generate the database (codefirst ), and the receiving parameters of the interface and the corresponding parameter entities are all in this library. B .4 Pls. the UnitOfWor class library is the implementation of the work unit. It encapsulates the implementation of the work unit to achieve unified Transaction Management B .5 Pls. the Utils class library is a public class implementation that encapsulates public classes, read configuration files, send emails, qiniu cloud, and redis. B .6 ProgrammersLiveShow is the main project, mainly. NET Core MVC Architecture, because the current front-end and back-end management of the entire project is under a configuration file, no read/write splitting, therefore, the entire architecture is shown in (if we plan to perform read/write splitting later, we can create a ProgrammersLiveShowWebApi project to provide services ). 3.Primary project description of chuxinyuan mallA. We briefly introduced the framework structure of this project. Next we will introduce the simple architecture of the main project so that you can be familiar with the functions of project folders and files, the following describes several different configurations of a.1 launchSettings. json this file is in Properties and mainly used in ASP.. NET Core application configuration, used for application startup preparation, including environment variables, development ports, and enabling some verification, the modification in this configuration file is basically the same as the content submitted after the developer uses the right-click Attribute Modification, and supports synchronous updates. A.2 The wwwroot folder is a folder that stores static content, such as css, js, and img files. The advantage of this is that it is very convenient for dynamic separation, and bower can be used for external JS and CSS references. json implementation, but this project unfortunately configures bower. json is not successful. This is because after the configuration, the manual configuration reference JS version is very slow during loading, and the version loaded on each machine is also faulty. I don't know why, if you know, please leave a message and let me know, so here I basically use the JS path provided by the Free CDN website and all the package environments deployed in the project. A.3 autofac dependency injection we didn't use the dependency injection that comes with. NET Core. Instead, we used AutoFac. I chose AutoFac for dependency injection. A.4 component configuration, creates classes and inherits from ViewComponent. I like this feature very much because it can be componentized and encapsulated by many common page modules. A.5 document configuration description of this project file, including the project specifications and database files, as well as the required reading information of the development project. A.6 some interceptors written by the filter themselves are intercepted by permission control and other information a.7 job timing tasks. We use Pomelo. aspNetCore. the TimedJob timing plug-in is used to delete unresponded reviews and unpaid orders within seven days after purchase. A.8 Startup. the cs file is.. NET Core Startup entry file. when the project is started and running, the compiler automatically searches for Startup in the program set. in addition to constructors, the cs file can read the startup configuration and define Configure and ConfigureServices methods. A.9 nlog log configuration file. We use the NLog. Extensions. Logging plug-in to write the service configuration a.10 appsettings. json public configuration information. You can configure the SQL connection string and other public information. Project B uses a lot of technical things. The above is just a simple list and description. If I have the opportunity, I will explain the internal functions in depth. 4.Questions about chuxinyuan mallQuestion 1: I am using bower. when json is used to manage JS files, after various JS versions are configured in the configuration file, they are dynamically generated in the dependencies of the current machine, after dynamically generating JS Code from different machines, you may find that the dependent version is incorrect sometimes. It takes a long time to solve this problem. Why? Question 2: the configuration file is very inconvenient to use. In the previous receivetting configuration, we can easily call the configuration information. after the configuration in the configuration file of NET Core is configured, It is very troublesome to call other class libraries. Is there any simpler method? 5.Technology and deployment environment used by chuxinyuan mallA has used the above technologies in Phase I development of the project. We will use more technologies to improve the system in Phase II, if you have any questions or learn about the above technologies, you can join me on QQ to discuss them. B Source code management we use Git for management, deployed in open source China, convenient for many people to jointly develop c this project address: http://www.chuxinm.com, because the project to bear the cost of servers and domain names, therefore, the source code to collect some painstaking efforts, please forgive me, all people who get the source code can be any source code operations, the system is simple as follows: d Source Code address of this project: http://www.chuxinm.com/Home/Detail? Id = 8c2e2aff9290446ababf9c5905fa2609 This project Source Code address: http://www.chuxinm.com/Home/Detail? Id = 8c2e2aff9290446ababf9c5905fa2609In the next blog, I will explain how to deploy the. NET Core project to linux (under Centos ).

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.