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

原文鏈接:http://www.javashuo.com/article/p-ennntqlt-er.html html

轉載請註明出處web

 

介紹

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

 

原文[[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 安裝到項目中async

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

  

Noteide

注意添加 .AddMvc()模塊化

Asp.Net Mvc如今是您管道的一部分.spa

您能夠在此處找到示例應用程序: 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

 

 

原文鏈接:http://www.javashuo.com/article/p-ennntqlt-er.html 

轉載請註明出處

相關文章
相關標籤/搜索