-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for attributes on target method
- Loading branch information
1 parent
e49ae95
commit 61cee46
Showing
25 changed files
with
865 additions
and
0 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
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
69 changes: 69 additions & 0 deletions
69
...teTests.MapMethodWithProducesAttribute_method=Delete#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,69 @@ | ||
//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> | ||
{ | ||
|
||
public HandleBehavior( | ||
) | ||
{ | ||
} | ||
|
||
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 | ||
, 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
...MapMethodWithProducesAttribute_method=Delete#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 AddTestsBehaviors( | ||
this IServiceCollection services) | ||
{ | ||
|
||
return services; | ||
} | ||
|
||
public static IServiceCollection AddTestsHandlers( | ||
this IServiceCollection services, | ||
ServiceLifetime lifetime = ServiceLifetime.Scoped | ||
) | ||
{ | ||
global::Dummy.GetUsersQuery.AddHandlers(services, lifetime); | ||
|
||
return services; | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
...pMethodWithProducesAttribute_method=Delete#RouteBuilder.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,40 @@ | ||
//HintName: RouteBuilder.Dummy_GetUsersQuery.g.cs | ||
using System.Threading; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Routing; | ||
|
||
#pragma warning disable CS1591 | ||
|
||
namespace Microsoft.AspNetCore.Builder | ||
{ | ||
public static partial class TestsRoutesBuilder | ||
{ | ||
private static void MapDummy_GetUsersQueryEndpoint(IEndpointRouteBuilder app) | ||
{ | ||
var endpoint = app | ||
.MapDelete( | ||
"/test", | ||
[global::Microsoft.AspNetCore.Mvc.ProducesResponseTypeAttribute<int>(200)] | ||
async ( | ||
[AsParameters] global::Dummy.GetUsersQuery.Query parameters, | ||
[FromServices] global::Dummy.GetUsersQuery.Handler handler, | ||
CancellationToken token | ||
) => | ||
{ | ||
var ret = await handler.HandleAsync(parameters, token); | ||
return ret; | ||
} | ||
); | ||
|
||
_ = endpoint.AllowAnonymous(); | ||
} | ||
} | ||
} | ||
|
||
namespace Dummy | ||
{ | ||
|
||
/// <remarks><see cref="global::Dummy.GetUsersQuery.Query" /> registered using <c>[AsParameters]</c></remarks> | ||
partial class GetUsersQuery; | ||
} |
19 changes: 19 additions & 0 deletions
19
...odAttributeTests.MapMethodWithProducesAttribute_method=Delete#RoutesBuilder.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,19 @@ | ||
//HintName: RoutesBuilder.g.cs | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Routing; | ||
|
||
#pragma warning disable CS1591 | ||
|
||
namespace Microsoft.AspNetCore.Builder; | ||
|
||
public static partial class TestsRoutesBuilder | ||
{ | ||
public static IEndpointRouteBuilder MapTestsEndpoints( | ||
this IEndpointRouteBuilder app | ||
) | ||
{ | ||
MapDummy_GetUsersQueryEndpoint(app); | ||
|
||
return app; | ||
} | ||
} |
69 changes: 69 additions & 0 deletions
69
...ibuteTests.MapMethodWithProducesAttribute_method=Get#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,69 @@ | ||
//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> | ||
{ | ||
|
||
public HandleBehavior( | ||
) | ||
{ | ||
} | ||
|
||
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 | ||
, 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.MapMethodWithProducesAttribute_method=Get#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 AddTestsBehaviors( | ||
this IServiceCollection services) | ||
{ | ||
|
||
return services; | ||
} | ||
|
||
public static IServiceCollection AddTestsHandlers( | ||
this IServiceCollection services, | ||
ServiceLifetime lifetime = ServiceLifetime.Scoped | ||
) | ||
{ | ||
global::Dummy.GetUsersQuery.AddHandlers(services, lifetime); | ||
|
||
return services; | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
....MapMethodWithProducesAttribute_method=Get#RouteBuilder.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,40 @@ | ||
//HintName: RouteBuilder.Dummy_GetUsersQuery.g.cs | ||
using System.Threading; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Routing; | ||
|
||
#pragma warning disable CS1591 | ||
|
||
namespace Microsoft.AspNetCore.Builder | ||
{ | ||
public static partial class TestsRoutesBuilder | ||
{ | ||
private static void MapDummy_GetUsersQueryEndpoint(IEndpointRouteBuilder app) | ||
{ | ||
var endpoint = app | ||
.MapGet( | ||
"/test", | ||
[global::Microsoft.AspNetCore.Mvc.ProducesResponseTypeAttribute<int>(200)] | ||
async ( | ||
[AsParameters] global::Dummy.GetUsersQuery.Query parameters, | ||
[FromServices] global::Dummy.GetUsersQuery.Handler handler, | ||
CancellationToken token | ||
) => | ||
{ | ||
var ret = await handler.HandleAsync(parameters, token); | ||
return ret; | ||
} | ||
); | ||
|
||
_ = endpoint.AllowAnonymous(); | ||
} | ||
} | ||
} | ||
|
||
namespace Dummy | ||
{ | ||
|
||
/// <remarks><see cref="global::Dummy.GetUsersQuery.Query" /> registered using <c>[AsParameters]</c></remarks> | ||
partial class GetUsersQuery; | ||
} |
Oops, something went wrong.