-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support attributes on input parameters
- Loading branch information
1 parent
fde50b9
commit 5098987
Showing
10 changed files
with
489 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...ndlerTests.ComplexParameterAttribute_assemblies=Msdi#IH.Dummy.GetUsersQuery.g.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
//HintName: IH.Dummy.GetUsersQuery.g.cs | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
#pragma warning disable CS1591 | ||
|
||
namespace Dummy; | ||
|
||
partial class GetUsersQuery | ||
{ | ||
public sealed partial class Handler : global::Immediate.Handlers.Shared.IHandler<global::Dummy.GetUsersQuery.Query, int> | ||
{ | ||
private readonly global::Dummy.GetUsersQuery.HandleBehavior _handleBehavior; | ||
|
||
public Handler( | ||
global::Dummy.GetUsersQuery.HandleBehavior handleBehavior | ||
) | ||
{ | ||
var handlerType = typeof(GetUsersQuery); | ||
|
||
_handleBehavior = handleBehavior; | ||
|
||
} | ||
|
||
public async global::System.Threading.Tasks.ValueTask<int> HandleAsync( | ||
global::Dummy.GetUsersQuery.Query request, | ||
global::System.Threading.CancellationToken cancellationToken = default | ||
) | ||
{ | ||
return await _handleBehavior | ||
.HandleAsync(request, cancellationToken) | ||
.ConfigureAwait(false); | ||
} | ||
} | ||
|
||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] | ||
public sealed class HandleBehavior : global::Immediate.Handlers.Shared.Behavior<global::Dummy.GetUsersQuery.Query, int> | ||
{ | ||
private readonly global::Dummy.Service _service; | ||
|
||
public HandleBehavior( | ||
[global::Dummy.TestAttribute(["Dummy1", "Dummy2"], ["Dummy1", "Dummy2"], ["Dummy3", "Dummy4"])] global::Dummy.Service service | ||
) | ||
{ | ||
_service = service; | ||
} | ||
|
||
public override async global::System.Threading.Tasks.ValueTask<int> HandleAsync( | ||
global::Dummy.GetUsersQuery.Query request, | ||
global::System.Threading.CancellationToken cancellationToken | ||
) | ||
{ | ||
return await global::Dummy.GetUsersQuery | ||
.HandleAsync( | ||
request | ||
, _service | ||
, cancellationToken | ||
) | ||
.ConfigureAwait(false); | ||
} | ||
} | ||
|
||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] | ||
public static IServiceCollection AddHandlers( | ||
IServiceCollection services, | ||
ServiceLifetime lifetime = ServiceLifetime.Scoped | ||
) | ||
{ | ||
services.Add(new(typeof(global::Dummy.GetUsersQuery.Handler), typeof(global::Dummy.GetUsersQuery.Handler), lifetime)); | ||
services.Add(new(typeof(global::Immediate.Handlers.Shared.IHandler<global::Dummy.GetUsersQuery.Query, int>), typeof(global::Dummy.GetUsersQuery.Handler), lifetime)); | ||
services.Add(new(typeof(global::Dummy.GetUsersQuery.HandleBehavior), typeof(global::Dummy.GetUsersQuery.HandleBehavior), lifetime)); | ||
return services; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...ts.ComplexParameterAttribute_assemblies=Msdi#IH.ServiceCollectionExtensions.g.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
//HintName: IH.ServiceCollectionExtensions.g.cs | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.DependencyInjection.Extensions; | ||
|
||
#pragma warning disable CS1591 | ||
|
||
public static class HandlerServiceCollectionExtensions | ||
{ | ||
public static IServiceCollection AddBehaviors( | ||
this IServiceCollection services) | ||
{ | ||
|
||
return services; | ||
} | ||
|
||
public static IServiceCollection AddHandlers( | ||
this IServiceCollection services, | ||
ServiceLifetime lifetime = ServiceLifetime.Scoped | ||
) | ||
{ | ||
global::Dummy.GetUsersQuery.AddHandlers(services, lifetime); | ||
|
||
return services; | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
...lerTests.MultipleParameterAttributes_assemblies=Msdi#IH.Dummy.GetUsersQuery.g.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
//HintName: IH.Dummy.GetUsersQuery.g.cs | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
#pragma warning disable CS1591 | ||
|
||
namespace Dummy; | ||
|
||
partial class GetUsersQuery | ||
{ | ||
public sealed partial class Handler : global::Immediate.Handlers.Shared.IHandler<global::Dummy.GetUsersQuery.Query, int> | ||
{ | ||
private readonly global::Dummy.GetUsersQuery.HandleBehavior _handleBehavior; | ||
|
||
public Handler( | ||
global::Dummy.GetUsersQuery.HandleBehavior handleBehavior | ||
) | ||
{ | ||
var handlerType = typeof(GetUsersQuery); | ||
|
||
_handleBehavior = handleBehavior; | ||
|
||
} | ||
|
||
public async global::System.Threading.Tasks.ValueTask<int> HandleAsync( | ||
global::Dummy.GetUsersQuery.Query request, | ||
global::System.Threading.CancellationToken cancellationToken = default | ||
) | ||
{ | ||
return await _handleBehavior | ||
.HandleAsync(request, cancellationToken) | ||
.ConfigureAwait(false); | ||
} | ||
} | ||
|
||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] | ||
public sealed class HandleBehavior : global::Immediate.Handlers.Shared.Behavior<global::Dummy.GetUsersQuery.Query, int> | ||
{ | ||
private readonly global::Dummy.SomeKeyedService _service; | ||
|
||
public HandleBehavior( | ||
[global::Microsoft.Extensions.DependencyInjection.FromKeyedServicesAttribute("SomeServiceKey"), global::Dummy.TestAttribute(Message = "Test")] global::Dummy.SomeKeyedService service | ||
) | ||
{ | ||
_service = service; | ||
} | ||
|
||
public override async global::System.Threading.Tasks.ValueTask<int> HandleAsync( | ||
global::Dummy.GetUsersQuery.Query request, | ||
global::System.Threading.CancellationToken cancellationToken | ||
) | ||
{ | ||
return await global::Dummy.GetUsersQuery | ||
.HandleAsync( | ||
request | ||
, _service | ||
, cancellationToken | ||
) | ||
.ConfigureAwait(false); | ||
} | ||
} | ||
|
||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] | ||
public static IServiceCollection AddHandlers( | ||
IServiceCollection services, | ||
ServiceLifetime lifetime = ServiceLifetime.Scoped | ||
) | ||
{ | ||
services.Add(new(typeof(global::Dummy.GetUsersQuery.Handler), typeof(global::Dummy.GetUsersQuery.Handler), lifetime)); | ||
services.Add(new(typeof(global::Immediate.Handlers.Shared.IHandler<global::Dummy.GetUsersQuery.Query, int>), typeof(global::Dummy.GetUsersQuery.Handler), lifetime)); | ||
services.Add(new(typeof(global::Dummy.GetUsersQuery.HandleBehavior), typeof(global::Dummy.GetUsersQuery.HandleBehavior), lifetime)); | ||
return services; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
....MultipleParameterAttributes_assemblies=Msdi#IH.ServiceCollectionExtensions.g.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
//HintName: IH.ServiceCollectionExtensions.g.cs | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.DependencyInjection.Extensions; | ||
|
||
#pragma warning disable CS1591 | ||
|
||
public static class HandlerServiceCollectionExtensions | ||
{ | ||
public static IServiceCollection AddBehaviors( | ||
this IServiceCollection services) | ||
{ | ||
|
||
return services; | ||
} | ||
|
||
public static IServiceCollection AddHandlers( | ||
this IServiceCollection services, | ||
ServiceLifetime lifetime = ServiceLifetime.Scoped | ||
) | ||
{ | ||
global::Dummy.GetUsersQuery.AddHandlers(services, lifetime); | ||
|
||
return services; | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
...andlerTests.SimpleParameterAttribute_assemblies=Msdi#IH.Dummy.GetUsersQuery.g.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
//HintName: IH.Dummy.GetUsersQuery.g.cs | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
#pragma warning disable CS1591 | ||
|
||
namespace Dummy; | ||
|
||
partial class GetUsersQuery | ||
{ | ||
public sealed partial class Handler : global::Immediate.Handlers.Shared.IHandler<global::Dummy.GetUsersQuery.Query, int> | ||
{ | ||
private readonly global::Dummy.GetUsersQuery.HandleBehavior _handleBehavior; | ||
|
||
public Handler( | ||
global::Dummy.GetUsersQuery.HandleBehavior handleBehavior | ||
) | ||
{ | ||
var handlerType = typeof(GetUsersQuery); | ||
|
||
_handleBehavior = handleBehavior; | ||
|
||
} | ||
|
||
public async global::System.Threading.Tasks.ValueTask<int> HandleAsync( | ||
global::Dummy.GetUsersQuery.Query request, | ||
global::System.Threading.CancellationToken cancellationToken = default | ||
) | ||
{ | ||
return await _handleBehavior | ||
.HandleAsync(request, cancellationToken) | ||
.ConfigureAwait(false); | ||
} | ||
} | ||
|
||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] | ||
public sealed class HandleBehavior : global::Immediate.Handlers.Shared.Behavior<global::Dummy.GetUsersQuery.Query, int> | ||
{ | ||
private readonly global::Dummy.SomeKeyedService _service; | ||
|
||
public HandleBehavior( | ||
[global::Microsoft.Extensions.DependencyInjection.FromKeyedServicesAttribute("SomeServiceKey")] global::Dummy.SomeKeyedService service | ||
) | ||
{ | ||
_service = service; | ||
} | ||
|
||
public override async global::System.Threading.Tasks.ValueTask<int> HandleAsync( | ||
global::Dummy.GetUsersQuery.Query request, | ||
global::System.Threading.CancellationToken cancellationToken | ||
) | ||
{ | ||
return await global::Dummy.GetUsersQuery | ||
.HandleAsync( | ||
request | ||
, _service | ||
, cancellationToken | ||
) | ||
.ConfigureAwait(false); | ||
} | ||
} | ||
|
||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] | ||
public static IServiceCollection AddHandlers( | ||
IServiceCollection services, | ||
ServiceLifetime lifetime = ServiceLifetime.Scoped | ||
) | ||
{ | ||
services.Add(new(typeof(global::Dummy.GetUsersQuery.Handler), typeof(global::Dummy.GetUsersQuery.Handler), lifetime)); | ||
services.Add(new(typeof(global::Immediate.Handlers.Shared.IHandler<global::Dummy.GetUsersQuery.Query, int>), typeof(global::Dummy.GetUsersQuery.Handler), lifetime)); | ||
services.Add(new(typeof(global::Dummy.GetUsersQuery.HandleBehavior), typeof(global::Dummy.GetUsersQuery.HandleBehavior), lifetime)); | ||
return services; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...sts.SimpleParameterAttribute_assemblies=Msdi#IH.ServiceCollectionExtensions.g.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
//HintName: IH.ServiceCollectionExtensions.g.cs | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.DependencyInjection.Extensions; | ||
|
||
#pragma warning disable CS1591 | ||
|
||
public static class HandlerServiceCollectionExtensions | ||
{ | ||
public static IServiceCollection AddBehaviors( | ||
this IServiceCollection services) | ||
{ | ||
|
||
return services; | ||
} | ||
|
||
public static IServiceCollection AddHandlers( | ||
this IServiceCollection services, | ||
ServiceLifetime lifetime = ServiceLifetime.Scoped | ||
) | ||
{ | ||
global::Dummy.GetUsersQuery.AddHandlers(services, lifetime); | ||
|
||
return services; | ||
} | ||
} |
Oops, something went wrong.