Orchard Core Framework:ASP.NET Core Modular, multi-tenant framework

Source: Internet
Author: User

Orchard Core Framework:ASP.NET Core Modular, multi-tenant framework

The previous authoring Orchard Core builds an ASP. NET core CMS, introducing the ASP. NET core CMS, orchard ASP, with an ASP. NET Core framework.

Support for modularity and multi-tenancy. The entire orchard Core is made up of modules module

First create an empty ASP. NET Core Web application as a base. The following module to learn the establishment and use.

Modular

First, in the previously created ASP. NET Core Web application, create a new class library (. NET core) project as Moduleweb.

Then add MICROSOFT.ASPNETCORE.MVC and OrchardCore.Module.Targets references.

The command is as follows:

Install-package MICROSOFT.ASPNETCORE.MVC

Install-package Orchardcore.module.targets-pre

Then we can add a view folder and Controllers folder, as well as add a homecontroller and corresponding views page.

Because there are no good new shortcuts on the class library, we recommend that you copy them from the ASP. NET Core Web project.

     Public class Homecontroller:controller    {        public  iactionresult Index ()        {            return  View ();        }    }

Home/index.cshtml

 from Moduleweb/home/index

The Module is created and then referenced in the ASP. NET Core Web project.

You first need to add a OrchardCore.Application.Mvc.Targets package to your Web project

Install-package Orchardcore.application.mvc.targets-pre

The Moduleweb project is then referenced.

Change Startup.cs as follows:

     Public class Startup    {        publicvoid  configureservices (iservicecollection services)        {            services. Addmodules ();        }          Public void Configure (Iapplicationbuilder app, ihostingenvironment env)        {            if  (env. Isdevelopment ())            {                app. Usedeveloperexceptionpage ();            }            App. Usemodules ();        }    }

Note the references in the project are Microsoft.aspnetcore and Microsoft.ApplicationInsights.AspNetCore, which are configured as follows

<ItemGroup> <packagereference include="Microsoft.ApplicationInsights.AspNetCore"version="2.0.0"/> <packagereference include="Microsoft.aspnetcore"version="2.0.0"/> <packagereference include="OrchardCore.Application.Mvc.Targets"version="1.0.0-beta1-3667"/> </ItemGroup> <ItemGroup> <projectreference include=".. \moduleweb\moduleweb.csproj"/> </ItemGroup>

Then run the program, enter Moduleweb/home/index as follows

Multi-tenancy

Orchard Core Framework:ASP.NET Core Modular, multi-tenant framework

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.