mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
100 lines
3.3 KiB
100 lines
3.3 KiB
// ==========================================================================
|
|
// WriteModule.cs
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex Group
|
|
// All rights reserved.
|
|
// ==========================================================================
|
|
|
|
using Autofac;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Squidex.Core.Schemas;
|
|
using Squidex.Infrastructure.CQRS.Commands;
|
|
using Squidex.Pipeline.CommandHandlers;
|
|
using Squidex.Write.Apps;
|
|
using Squidex.Write.Assets;
|
|
using Squidex.Write.Contents;
|
|
using Squidex.Write.Schemas;
|
|
|
|
// ReSharper disable UnusedAutoPropertyAccessor.Local
|
|
|
|
namespace Squidex.Config.Domain
|
|
{
|
|
public class WriteModule : Module
|
|
{
|
|
private IConfiguration Configuration { get; }
|
|
|
|
public WriteModule(IConfiguration configuration)
|
|
{
|
|
Configuration = configuration;
|
|
}
|
|
|
|
protected override void Load(ContainerBuilder builder)
|
|
{
|
|
builder.RegisterType<EnrichWithExpectedVersionHandler>()
|
|
.As<ICommandHandler>()
|
|
.SingleInstance();
|
|
|
|
builder.RegisterType<EnrichWithTimestampHandler>()
|
|
.As<ICommandHandler>()
|
|
.SingleInstance();
|
|
|
|
builder.RegisterType<EnrichWithActorHandler>()
|
|
.As<ICommandHandler>()
|
|
.SingleInstance();
|
|
|
|
builder.RegisterType<EnrichWithAppIdHandler>()
|
|
.As<ICommandHandler>()
|
|
.SingleInstance();
|
|
|
|
builder.RegisterType<EnrichWithSchemaIdHandler>()
|
|
.As<ICommandHandler>()
|
|
.SingleInstance();
|
|
|
|
builder.RegisterType<FieldRegistry>()
|
|
.AsSelf()
|
|
.SingleInstance();
|
|
|
|
builder.RegisterType<AppCommandHandler>()
|
|
.As<ICommandHandler>()
|
|
.SingleInstance();
|
|
|
|
builder.RegisterType<AssetCommandHandler>()
|
|
.As<ICommandHandler>()
|
|
.SingleInstance();
|
|
|
|
builder.RegisterType<ContentCommandHandler>()
|
|
.As<ICommandHandler>()
|
|
.SingleInstance();
|
|
|
|
builder.RegisterType<SchemaCommandHandler>()
|
|
.As<ICommandHandler>()
|
|
.SingleInstance();
|
|
|
|
builder.RegisterType<SetVersionAsETagHandler>()
|
|
.As<ICommandHandler>()
|
|
.SingleInstance();
|
|
|
|
builder.Register<DomainObjectFactoryFunction<AppDomainObject>>(c => (id => new AppDomainObject(id, -1)))
|
|
.AsSelf()
|
|
.SingleInstance();
|
|
|
|
builder.Register<DomainObjectFactoryFunction<AssetDomainObject>>(c => (id => new AssetDomainObject(id, -1)))
|
|
.AsSelf()
|
|
.SingleInstance();
|
|
|
|
builder.Register<DomainObjectFactoryFunction<ContentDomainObject>>(c => (id => new ContentDomainObject(id, -1)))
|
|
.AsSelf()
|
|
.SingleInstance();
|
|
|
|
builder.Register<DomainObjectFactoryFunction<SchemaDomainObject>>(c =>
|
|
{
|
|
var fieldRegistry = c.Resolve<FieldRegistry>();
|
|
|
|
return (id => new SchemaDomainObject(id, -1, fieldRegistry));
|
|
})
|
|
.AsSelf()
|
|
.SingleInstance();
|
|
}
|
|
}
|
|
}
|
|
|