Orchard Core 文檔翻譯 (三) Orchard Core Modules

原文連接:https://www.cnblogs.com/Qbit/p/9746442.html 

轉載請註明出處

 

介紹

Orchard Core Modules庫提供了一種機制,可以擁有一個獨立的模塊化系統,您可以選擇加入特定的應用程序框架,而不必依賴於您的應用程序設計。 

 

原文[[The library Orchard Core Modules provides a mechanism to have a self-contained modular system where you can opt in to a specific application framework and not have the design of your application be dictated to by such.
]]...

 

 

快速入門

 

在Visual Studio中,創建一個新的Web應用程序。
通過管理項目NuGet包將OrchardCore.Application.Cms.Targets安裝到項目中。
接下來,在Startup.cs中,修改ConfigureServices方法,添加以下行:

 

 

services.AddOrchardCms(); 

 

 

接下來,在Configure方法的末尾,
用這一行:
 
app.UseOrchardCore();
替換此塊: 
app.Run(async(context)=>
{
    await context.Response.WriteAsync(“Hello World!”);
});
 
 

 

其他框架

您可以輕鬆地將喜愛的應用程序框架添加到管道中。以下實現旨在並行工作,因此如果您想在管道中使用Asp.Net Mvc和Nancy,只需添加兩者即可。

下面的模塊化框架包裝器被設計爲直接與模塊化應用程序框架一起工作,因此避免添加原始框架並期望它可以工作。 

 

原文[[The modular framework wrappers below are designed to work directly with the modular application framework, so avoid just adding the raw framework and expect it to just work.]]...

Asp.Net Mvc

通過NuGet包管理器將OrchardCore.Application.Mvc.Targets 安裝到項目中

接下來,在Startup.cs中,將方法ConfigureServices修改爲如下所示:
 // Add ASP.NET MVC and support for modules            
 services.AddOrchardCore()
         .AddMvc();

  

Note

注意添加 .AddMvc()

Asp.Net Mvc現在是您管道的一部分.

您可以在此處找到示例應用程序: OrchardCore.Mvc.Web

NancyFx

通過管理項目NuGet包將OrchardCore.Application.Nancy.Targets安裝到項目中

接下來,在Startup.cs中,將方法ConfigureServices修改爲如下所示:

 // Add Nancy and support for modules
            services
                .AddOrchardCore()
                .AddNancy()
                ;

 

 

Note

注意添加 .AddNancy()

NancyFx 現在是您管道的一部分。這意味着Nancy模塊將被自動發現。

您可以在這裏找到一個示例應用程序: OrchardCore.Nancy.Web

 

 

原文連接:https://www.cnblogs.com/Qbit/p/9746442.html 

轉載請註明出處

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章