sozsoft-platform/api/modules/Sozsoft.MailQueue/SozsoftMailQueueModule.cs

80 lines
2.5 KiB
C#
Raw Normal View History

2026-02-24 20:44:16 +00:00
using System.Reflection;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.DependencyInjection;
using Sozsoft.MailQueue.Domain.Shared;
using Sozsoft.MailQueue.EntityFrameworkCore;
using Sozsoft.Sender;
2026-02-24 20:44:16 +00:00
using Volo.Abp.Application;
using Volo.Abp.Authorization;
using Volo.Abp.Domain;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Localization;
using Volo.Abp.Localization.ExceptionHandling;
using Volo.Abp.Mapperly;
2026-02-24 20:44:16 +00:00
using Volo.Abp.Modularity;
using Volo.Abp.TextTemplating.Razor;
using Volo.Abp.VirtualFileSystem;
using Wkhtmltopdf.NetCore;
namespace Sozsoft.MailQueue;
[DependsOn(
typeof(AbpDddDomainModule),
typeof(AbpDddApplicationModule),
typeof(AbpDddApplicationContractsModule),
2026-05-24 22:23:52 +00:00
typeof(AbpMapperlyModule),
2026-02-24 20:44:16 +00:00
typeof(AbpAuthorizationModule),
typeof(AbpEntityFrameworkCoreModule),
typeof(AbpTextTemplatingRazorModule),
2026-10-17 18:51:10 +00:00
typeof(SozsoftSenderModule)
2026-02-24 20:44:16 +00:00
)]
2026-10-17 18:51:10 +00:00
public class SozsoftMailQueueModule : AbpModule
2026-02-24 20:44:16 +00:00
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
2026-10-17 18:51:10 +00:00
context.Services.AddMapperlyObjectMapper<SozsoftMailQueueModule>();
2026-02-24 20:44:16 +00:00
Configure<AbpLocalizationOptions>(options =>
{
2026-10-17 18:51:10 +00:00
options.Resources.Add<SozsoftMailQueueResource>("en");
2026-02-24 20:44:16 +00:00
});
Configure<AbpExceptionLocalizationOptions>(options =>
{
2026-10-17 18:51:10 +00:00
options.MapCodeNamespace("MailQueue", typeof(SozsoftMailQueueResource));
2026-02-24 20:44:16 +00:00
});
context.Services.AddAbpDbContext<MailQueueDbContext>(options =>
{
options.AddDefaultRepositories(includeAllEntities: true);
});
Configure<AbpRazorTemplateCSharpCompilerOptions>(options =>
{
2026-10-17 18:51:10 +00:00
options.References.Add(MetadataReference.CreateFromFile(typeof(SozsoftMailQueueModule).Assembly.Location));
2026-02-24 20:44:16 +00:00
});
Configure<AbpCompiledViewProviderOptions>(options =>
{
//Hello is template name.
options.TemplateReferences.Add("Hello", new List<Assembly>()
{
Assembly.Load("Microsoft.Extensions.Logging.Abstractions"),
Assembly.Load("Microsoft.Extensions.Logging")
}
.Select(x => MetadataReference.CreateFromFile(x.Location))
.ToList());
});
// FileGenerationModule
Configure<AbpVirtualFileSystemOptions>(options =>
{
2026-10-17 18:51:10 +00:00
options.FileSets.AddEmbedded<SozsoftMailQueueModule>();
2026-02-24 20:44:16 +00:00
});
context.Services.AddWkhtmltopdf($"FileGeneration{Path.DirectorySeparatorChar}Rotativa");
// FileGenerationModule
}
}