/// <summary> /// Зарегистрировать логику /// </summary> /// <param name="appBuilder"></param> /// <param name="settings"></param> public static void RegisterLogic(CrocoApplicationBuilder appBuilder, EccSettings settings) { Check(appBuilder); var services = appBuilder.Services; services.AddHttpClient <OneSignalClient>(); RegisterServices <CltUserMasterStorage>(services, settings); services.AddScoped <IFileMasterStorage, CrocoFileMasterStorage>(); RegisterEccWorkerTypes(services); AddMessageHandlers(appBuilder); var descriptionBuilder = appBuilder.IntegrationMessagesDescriptorBuilder; descriptionBuilder .AddMessageDescription <CreateUserCommand>("Команда для создания пользователя", IntegrationMessageType.Command) .AddMessageDescription <UpdateUserCommand>("Команда для обновления данных пользователя", IntegrationMessageType.Command) .AddMessageDescription <AppendEmailsFromFileToGroup>("Команда для добавления эмейлов в групу из файла", IntegrationMessageType.Command) .AddMessageDescription <SendMailsForEmailGroup>("Команда для отправки эмейлов для групы", IntegrationMessageType.Command); descriptionBuilder .AddMessageDescription <ChatCreatedEvent>("Событие о том, что чат создался", IntegrationMessageType.Event) .AddMessageDescription <ChatRelationUpdatedEvent>("Событие о том, что пользователь посетил чат или зашёл в него", IntegrationMessageType.Event); }
private static void RegisterServices <TUserStorage>(IServiceCollection services, EccSettings settings) where TUserStorage : class, IUserMasterStorage { services.AddScoped <IUserMasterStorage, TUserStorage>(); services.AddSingleton(settings); if (!services.Any(x => x.ServiceType == typeof(IEmailSender))) { services.AddScoped <IEmailSender, SmtpEmailSender>(); } services.AddSingleton <EccPixelUrlProvider>(); services.AddSingleton <EmailListExtractor>(); }
/// <summary> /// Конструктор /// </summary> /// <param name="settings"></param> public EccPixelUrlProvider(EccSettings settings) { PixelEmalUrlFormat = settings.PixelUrlProviderOptions.PixelEmailUrlFormat; }
/// <summary> /// Конструктор /// </summary> /// <param name="ambientContextAccessor"></param> /// <param name="application"></param> /// <param name="settings"></param> public EmailLinkFunctionInvoker(ICrocoAmbientContextAccessor ambientContextAccessor, ICrocoApplication application, EccSettings settings) : base(ambientContextAccessor, application) { UrlRedirectFormat = settings.FunctionInvokerSettings.UrlRedirectFormat; }