. NET cross-platform Mac vs Code Multilayer architecture programming

Source: Internet
Author: User

Hefei Programmer Group: 49313181. Hefei Real-name programmer Group: 128131462 (do not want to disclose names and information to join, application notes fill in the name + technology + working life)
Q q:408365330 E-mail:[email protected]

Overview:

In order to study cross-platform. NET development, I intend to use. NET core to write a cross-platform CMS, this CMS I also take the principle of open source on GitHub, for the. NET open source community to make a little contribution. If interested can contact me together for. NET open source and cross-platform make a little contribution to it. egojitcms Portal GitHub Address:https://github.com/egojit8/EgojitCMS.git

Technical architecture and Design selection ASP. NET MVC core+entityframework Core+mysql/sqlite

The 2 databases that connect MySQL database and embedded SQLite support the CMS completely enough and are open source cross-platform. The institution uses the initial contact. NET development is the time of the classic three-tier architecture, but there is no SqlHelper class, this architecture as a framework for the development of CMS perfectly fit, we just develop a simple CMS without the framework of the whole is too complex, god horse field Drive mode (DDD) development, command responsibility Query separation mode (CQRS) development is not necessary here (I also use not good, haha ...). I have always thought that the best framework for the project is the most suitable frame, a bunch of technicians are always in the pursuit of encapsulation and encapsulation of the simple project is too complex, no need, exhausted himself also exhausted team members and also increased the project's problem probability.

The database operation is based on EF's super-good ORM framework, analogous to hibernate or MyBatis in Java Web development, except that EF is smarter. Why Choose EF? Because it allows us to operate the database very well, and by setting different provider can implement multi-database operation, switch database so easy! and this CMS is new development, all have no ready-made database, then use EF for code first development, Let developers focus more on object-oriented class design without having to contend with a two-dimensional relational table (making this work a professional DBA).

Mac vs Code Multilayer Architecture programming:

Many people initially contacted. NET core out of Visual Studio, the strongest IDE in the universe, didn't know how to organize their own projects, because here we are the classic three-tier programming, but here we use open source cross-platform vs code without vs so Invincible intelligence, Everything goes back to the most primitive and essential states, and we have to understand how to organize our project structure and build the pace of adjustment.

. NET Core manages the project in the form of a file directory, which is simpler and clearer, and the root of our project is egojitcms, so we're going to create a new directory in our project in order to adapt to the VS our appropriate adjustment directory. Create a new src directory in the Egojitcms directory as the source directory, and then you know the Bll,dll,comm,models,web

We are curious is not three layers, three generations of more, haha ..., if you want to be a multi-layered architecture. The web is called Web layer, which is the MVC related code and structure, the other is the library file layer. Not each layer is introduced, why build these layers do not say, only take models layer of things. New Project.json This is a layer configuration file that can be easily understood as a MAVEN configuration file in Java Web Development, which manages reference libraries and some tool configurations, as follows:

{  "Version": "1.0.0-*",  "Dependencies": {    "Microsoft.entityframeworkcore": "1.0.0",    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",    "POMELO.ENTITYFRAMEWORKCORE.MYSQL": "1.0.0"  },  "Tools": {    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",    "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"  },    "Frameworks": {    "Netcoreapp1.0": {      "Dependencies": {        "Microsoft.NETCore.App": {          "Type": "Platform",          "Version": "1.0.0-*"        }      }      //"Imports": "Dnxcore50"    }  }}

A lot of things can go to the official website of the document to learn than I said better access to the official portal

You can add related class files after configuration.

This library is built, how can it be used by the web layer or other layers? Need to be configured in Project.json in the Web tier

Then get the related library by dotnet Restore reset. This allows the web layer to use the class of the models layer. The MVC template project was created by the Yo ASPNET command, which was already said in the previous article. Be sure to go to the web layer to execute yo ASPNET to build the MVC template structure into the web. Please see the animated GIF below to see a smart prompt and show User:

Then the basic framework is built. The ultimate institutions such as:

But this time if the direct F5 operation will be an error. Because the path that is configured in the auto-generated Launch.json is incorrect, you need to manually modify the configuration according to the authority under your project's root directory:

Modify the Tasks.json at the same time:

This allows you to debug and run breakpoints directly F5

At last:

All of these are the groundwork for the Egojitcms, the time rush. Hope. NET open source and cross-platform farther.

. NET cross-platform Mac vs Code Multilayer architecture programming

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.