1 Star 0 Fork 0

github_mirrors / OrchardCore.Samples

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-3-Clause

Orchard Core Framework Samples

Sample web applications demonstrating how to build a Modular and Multi-Tenant ASP.NET Core application using the Orchard Core Framework.

You can watch a video providing a step by step demonstration of building a modular, multi-tenant Orchard Core Framework application here https://www.youtube.com/watch?v=yrQaKv2mxFU&list=PLReL099Y5nRd04p81Q7p5TtyjCrj9tz1t. It was presented at .NET Conf 2019 using Orchard Core RC1. The names of the C# projects in the demo do not match these sample projects, but the demonstration is very similar to these samples.

Contents of the Solution

MultiTenantApplication

An ASP.NET Core MVC application that references the modules projects, and provides two tenants with different modules enabled.

The homepage of this web application provides more information, and links to the two tenants and module endpoints. The tenants and their features are configured in the "OrchardCore" section of the appsettings.json file.

ModularApplication

A simple ASP.NET Core application that references the modules.

Module1

A sample module containing ASP.NET Core MVC controllers, views, and pages.

Module2

A sample module that registers custom middleware.

Running

From Visual Studio 2019

Open the OrchardCore.Samples.sln solution file and run either application and visit its homepage (any project with a name ending in "Application").

Open the website in your browser, and use the URLs or links it provides to explore.

From the Command Line

Open either Web application folder, ModularApplication or MultiTenantApplication, then run these commands:

  • dotnet restore
  • dotnet build
  • dotnet run

Multi-Tenant

The non-default tenants are prefixed with /customer-a and /customer-b. For instance, accessing /customer-b/Module2/hello will invoke the middleware defined in Module2.

The tenants can be modified by editing the "OrchardCore" section of the appsettings.json file and restarting the application.

Note that tenants.json is no longer supported in Orchard Core Framework applications, and tenant information is read from the "OrchardCore" section provided by any of the configuration providers. In the MultiTenantApplication sample, the appsettings.json is used to configure the "OrchardCore" section.

Creating new Modules

Modules can be .NET Standard 2.0 class libraries or .NET Core 3.0 class libraries that reference the OrchardCore.Module.Targets Nuget Package.

If you need it, development Orchard Core Nuget packages are available in a MyGet feed at this url: https://nuget.cloudsmith.io/orchardcore/preview/v3/index.json

Optionally, modules can be packaged as Nuget packages and made available on Nuget or MyGet, including static files and views. The Orchard Core CMS builds upon the Orchard Core Framework. More examples of modules can be found for the Orchard Core CMS in this repository: https://github.com/OrchardCMS/OrchardCore

Creating New Modular or Multi-Tenant Applications

A modular application that hosts module only needs to reference one of these targets packages:

  • OrchardCore.Application.Targets: Allows the application to reference and import modules, and optionally use multi-tenancy.
  • OrchardCore.Application.Mvc.Targets: Same as OrchardCore.Application.Targets but also references the OrchardCore.Mvc module
  • OrchardCore.Application.Nancy.Targets: Same as OrchardCore.Application.Targets but also references the OrchardCore.Nancy module
Copyright (c) .NET Foundation. All rights reserved. BSD 3-Clause License - https://opensource.org/licenses/BSD-3-Clause Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Orchard nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

简介

OrchardCore.Samples 展开 收起
C# 等 4 种语言
BSD-3-Clause
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/github_mirrors/OrchardCore.Samples.git
git@gitee.com:github_mirrors/OrchardCore.Samples.git
github_mirrors
OrchardCore.Samples
OrchardCore.Samples
main

搜索帮助

344bd9b3 5694891 D2dac590 5694891