Fix project references
This commit is contained in:
parent
6e458e0053
commit
479bdda002
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\common\Elsa.Api.Common\Elsa.Api.Common.csproj" />
|
||||
<ProjectReference Include="..\..\modules\Elsa.Mediator\Elsa.Mediator.csproj" />
|
||||
<ProjectReference Include="..\..\modules\Elsa.Workflows.Core\Elsa.Workflows.Core.csproj" />
|
||||
<ProjectReference Include="..\..\modules\Elsa.Workflows.Management\Elsa.Workflows.Management.csproj" />
|
||||
<ProjectReference Include="..\..\modules\Elsa.Workflows.Runtime\Elsa.Workflows.Runtime.csproj" />
|
||||
|
|
|
|||
|
|
@ -10,12 +10,17 @@ namespace Elsa.Features;
|
|||
[DependsOn(typeof(ElsaFeature))]
|
||||
public class AppFeature : FeatureBase
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public AppFeature(IModule module) : base(module)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The configurator to invoke.
|
||||
/// </summary>
|
||||
public Action<IModule>? Configurator { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Configure()
|
||||
{
|
||||
Configurator?.Invoke(Module);
|
||||
|
|
|
|||
|
|
@ -18,10 +18,4 @@
|
|||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup><!-- <ProjectReference Include="..\..\common\Elsa.Features\Elsa.Features.csproj" />-->
|
||||
<!-- <ProjectReference Include="..\Elsa.Common\Elsa.Common.csproj" />-->
|
||||
|
||||
<Folder Include="Features\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -20,7 +20,7 @@ using Microsoft.Extensions.Options;
|
|||
namespace Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
/// <summary>
|
||||
/// Adds extension methods to <see cref="IModule"/> that enable & configure mediator specific features.
|
||||
/// Adds mediator services to the <see cref="IServiceCollection"/>.
|
||||
/// </summary>
|
||||
[PublicAPI]
|
||||
public static class DependencyInjectionExtensions
|
||||
|
|
@ -40,25 +40,33 @@ public static class DependencyInjectionExtensions
|
|||
.AddSingleton<IRequestPipeline, RequestPipeline>()
|
||||
.AddSingleton<ICommandPipeline, CommandPipeline>()
|
||||
.AddSingleton<INotificationPipeline, NotificationPipeline>()
|
||||
.AddSingleton<INotificationsChannel, NotificationsChannel>()
|
||||
.AddSingleton<ICommandsChannel, CommandsChannel>()
|
||||
.AddSingleton<IJobsChannel, JobsChannel>()
|
||||
.AddSingleton<IJobQueue, JobQueue>()
|
||||
.AddHostedService<JobRunnerHostedService>()
|
||||
.AddHostedService(sp =>
|
||||
{
|
||||
var options = sp.GetRequiredService<IOptions<MediatorOptions>>().Value;
|
||||
return ActivatorUtilities.CreateInstance<BackgroundCommandSenderHostedService>(sp, options.CommandWorkerCount);
|
||||
})
|
||||
.AddHostedService(sp =>
|
||||
{
|
||||
var options = sp.GetRequiredService<IOptions<MediatorOptions>>().Value;
|
||||
return ActivatorUtilities.CreateInstance<BackgroundEventPublisherHostedService>(sp, options.NotificationWorkerCount);
|
||||
})
|
||||
.CreateChannel<ICommand>()
|
||||
.CreateChannel<INotification>()
|
||||
;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds mediator hosted services to the <see cref="IServiceCollection"/>.
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <returns></returns>
|
||||
public static IServiceCollection AddMediatorHostedServices(this IServiceCollection services)
|
||||
{
|
||||
return services
|
||||
.AddSingleton<INotificationsChannel, NotificationsChannel>()
|
||||
.AddSingleton<ICommandsChannel, CommandsChannel>()
|
||||
.AddSingleton<IJobsChannel, JobsChannel>()
|
||||
.AddSingleton<IJobQueue, JobQueue>()
|
||||
.AddHostedService<JobRunnerHostedService>()
|
||||
.AddHostedService(sp =>
|
||||
{
|
||||
var options = sp.GetRequiredService<IOptions<MediatorOptions>>().Value;
|
||||
return ActivatorUtilities.CreateInstance<BackgroundCommandSenderHostedService>(sp, options.CommandWorkerCount);
|
||||
})
|
||||
.AddHostedService(sp =>
|
||||
{
|
||||
var options = sp.GetRequiredService<IOptions<MediatorOptions>>().Value;
|
||||
return ActivatorUtilities.CreateInstance<BackgroundEventPublisherHostedService>(sp, options.NotificationWorkerCount);
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a <see cref="Channel{T}"/> to the <see cref="IServiceCollection"/> and a hosted service that continuously reads from the channel and executes each received message.
|
||||
|
|
@ -193,16 +201,7 @@ public static class DependencyInjectionExtensions
|
|||
/// Registers all handlers from the specified assembly with the service container.
|
||||
/// </summary>
|
||||
public static IServiceCollection AddCommandHandlersFrom(this IServiceCollection services, Assembly assembly) => services.AddHandlersFromInternal<ICommandHandler>(assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Registers a channel for the specified type <c>T</c> as well as a channel reader and writer.
|
||||
/// </summary>
|
||||
public static IServiceCollection CreateChannel<T>(this IServiceCollection services) =>
|
||||
services
|
||||
.AddSingleton(CreateChannel<T>())
|
||||
.AddTransient(CreateChannelReader<T>)
|
||||
.AddTransient(CreateChannelWriter<T>);
|
||||
|
||||
|
||||
private static IServiceCollection AddHandlersFromInternal<TService, TMarker>(this IServiceCollection services) => services.AddHandlersFromInternal<TService>(typeof(TMarker));
|
||||
private static IServiceCollection AddHandlersFromInternal<TService>(this IServiceCollection services, Type assemblyMarkerType) => services.AddHandlersFromInternal<TService>(assemblyMarkerType.Assembly);
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ public class MediatorFeature : FeatureBase
|
|||
/// <inheritdoc />
|
||||
public override void Apply()
|
||||
{
|
||||
Services.AddMediator();
|
||||
Services
|
||||
.AddMediator()
|
||||
.AddMediatorHostedServices();
|
||||
}
|
||||
}
|
||||
|
|
@ -17,7 +17,6 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Elsa.Mediator\Elsa.Mediator.csproj" />
|
||||
<ProjectReference Include="..\Elsa.Workflows.Core\Elsa.Workflows.Core.csproj" />
|
||||
<ProjectReference Include="..\Elsa.Workflows.Management\Elsa.Workflows.Management.csproj" />
|
||||
</ItemGroup>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,9 @@
|
|||
namespace Elsa.Email.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Represents an email attachment.
|
||||
/// </summary>
|
||||
/// <param name="Content">The content of the attachment.</param>
|
||||
/// <param name="FileName">The name of the attachment.</param>
|
||||
/// <param name="ContentType">The content type of the attachment.</param>
|
||||
public record EmailAttachment(object Content, string? FileName, string? ContentType);
|
||||
|
|
@ -1,8 +1,22 @@
|
|||
namespace Elsa.Email.Options;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the encryption method to use when connecting to an SMTP server.
|
||||
/// </summary>
|
||||
public enum SmtpEncryptionMethod
|
||||
{
|
||||
/// <summary>
|
||||
/// No encryption.
|
||||
/// </summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// SSL/TLS encryption.
|
||||
/// </summary>
|
||||
SslTlS = 1,
|
||||
|
||||
/// <summary>
|
||||
/// STARTTLS encryption.
|
||||
/// </summary>
|
||||
StartTls = 2
|
||||
}
|
||||
Loading…
Reference in a new issue