受欢迎的博客标签

OrchardCore - Module

Published

OrchardCore定位于CMS系统。采用NuGet包管理各个模块。

vesion .Net 5.x

register service

/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Startup.cs

namespace OrchardCore.Deployment
{
    public class Startup : StartupBase
    {
        private readonly AdminOptions _adminOptions;

        public Startup(IOptions<AdminOptions> adminOptions)
        {
            _adminOptions = adminOptions.Value;
        }

        public override void ConfigureServices(IServiceCollection services)
        {
            services.AddScoped<INavigationProvider, AdminMenu>();
            services.AddScoped<RemoteInstanceService>();
            services.AddScoped<RemoteClientService>();
            services.AddScoped<IDeploymentTargetProvider, RemoteInstanceDeploymentTargetProvider>();
        }

OrchardCore/src/OrchardCore/OrchardCore.ContentManagement/ServiceCollectionExtensions.cs

namespace OrchardCore.ContentManagement
{
    public static class ServiceCollectionExtensions
    {
        public static IServiceCollection AddContentManagement(this IServiceCollection services)
        {
            services.AddScoped<ICacheContextProvider, ContentDefinitionCacheContextProvider>();
            services.TryAddScoped<IContentDefinitionManager, ContentDefinitionManager>();
            services.TryAddScoped<IContentDefinitionStore, DatabaseContentDefinitionStore>();
            services.TryAddScoped<IContentManager, DefaultContentManager>();
            services.TryAddScoped<IContentManagerSession, DefaultContentManagerSession>();
            services.AddSingleton<IIndexProvider, ContentItemIndexProvider>();
            services.AddScoped<IDataMigration, Migrations>();
            services.AddScoped<IContentHandler, UpdateContentsHandler>();
            services.AddScoped<IContentHandler, ContentPartHandlerCoordinator>();
            services.AddSingleton<ITypeActivatorFactory<ContentPart>, ContentPartFactory>();
            services.AddSingleton<ITypeActivatorFactory<ContentField>, ContentFieldFactory>();

            services.AddSingleton<IContentItemIdGenerator, DefaultContentItemIdGenerator>();
            services.AddScoped<IContentHandleManager, ContentHandleManager>();

            services.AddOptions<ContentOptions>();
            services.AddScoped<IContentPartHandlerResolver, ContentPartHandlerResolver>();

            return services;
        }

        public static IServiceCollection AddFileContentDefinitionStore(this IServiceCollection services)
        {
            services.RemoveAll<IContentDefinitionStore>();
            services.AddSingleton<IContentDefinitionStore, FileContentDefinitionStore>();
            services.AddScoped<FileContentDefinitionScopedCache>();

            return services;
        }
    }
}

OrchardCore/src/OrchardCore.Modules/OrchardCore.Workflows/Startup.cs

 

202131230

https://github.com/OrchardCMS/OrchardCore.Samples/blob/main/DashboardApplication/DashboardApplication.csproj

<Project Sdk="Microsoft.NET.Sdk.Web">

	<PropertyGroup>
		<TargetFramework>net6.0</TargetFramework>
		<ImplicitUsings>enable</ImplicitUsings>
	</PropertyGroup>

	<ItemGroup>
		<PackageReference Include="OrchardCore.Admin" Version="1.7.2" />
		<PackageReference Include="OrchardCore.Application.Mvc.Targets" Version="1.7.2" />
		<PackageReference Include="OrchardCore.Features" Version="1.7.2" />
		<PackageReference Include="OrchardCore.Infrastructure" Version="1.7.2" />
		<PackageReference Include="OrchardCore.Navigation" Version="1.7.2" />
		<PackageReference Include="OrchardCore.Recipes" Version="1.7.2" />
		<PackageReference Include="OrchardCore.Resources" Version="1.7.2" />
		<PackageReference Include="OrchardCore.Roles" Version="1.7.2" />
		<PackageReference Include="OrchardCore.Settings" Version="1.7.2" />
		<PackageReference Include="OrchardCore.Setup" Version="1.7.2" />
		<PackageReference Include="OrchardCore.Tenants" Version="1.7.2" />
		<PackageReference Include="OrchardCore.Themes" Version="1.7.2" />
		<PackageReference Include="OrchardCore.Users" Version="1.7.2" />
		<PackageReference Include="SafeMode" Version="1.7.2" />
		<PackageReference Include="TheAdmin" Version="1.7.2" />
		<!-- If Module1 were a NuGet package instead of a project you could reference it this way: <PackageReference Include="Module1" Version="1.0.4" /> -->
	</ItemGroup>

	<ItemGroup>
		<ProjectReference Include="..\Module1\Module1.csproj" />
		<ProjectReference Include="..\Module2\Module2.csproj" />
	</ItemGroup>

</Project>