diff --git a/src/Http/Wolverine.Http.Tests/Internal/Generated/WolverineHandlers/POST_api_tenants_tenant_counters_id_inc.cs b/src/Http/Wolverine.Http.Tests/Internal/Generated/WolverineHandlers/POST_api_tenants_tenant_counters_id_inc.cs deleted file mode 100644 index 8563fe2e7..000000000 --- a/src/Http/Wolverine.Http.Tests/Internal/Generated/WolverineHandlers/POST_api_tenants_tenant_counters_id_inc.cs +++ /dev/null @@ -1,77 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Marten.Publishing; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_api_tenants_tenant_counters_id_inc - public class POST_api_tenants_tenant_counters_id_inc : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; - - public POST_api_tenants_tenant_counters_id_inc(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _outboxedSessionFactory = outboxedSessionFactory; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - // Building the Marten session - await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); - if (!System.Guid.TryParse((string)httpContext.GetRouteValue("id"), out var id)) - { - httpContext.Response.StatusCode = 404; - return; - } - - - var counter = await documentSession.LoadAsync(id, httpContext.RequestAborted).ConfigureAwait(false); - // 404 if this required object is null - if (counter == null) - { - httpContext.Response.StatusCode = 404; - return; - } - - - // The actual HTTP request handler execution - (var result, var martenOp) = Wolverine.Http.Tests.Bugs.CounterEndpoint.Increment(counter); - - if (martenOp != null) - { - - // Placed by Wolverine's ISideEffect policy - martenOp.Execute(documentSession); - - } - - - // Commit any outstanding Marten changes - await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); - - - // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 - await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); - - await result.ExecuteAsync(httpContext).ConfigureAwait(false); - } - - } - - // END: POST_api_tenants_tenant_counters_id_inc - - -} - diff --git a/src/Http/Wolverine.Http.Tests/Internal/Generated/WolverineHandlers/POST_api_tenants_tenant_counters_id_inc2.cs b/src/Http/Wolverine.Http.Tests/Internal/Generated/WolverineHandlers/POST_api_tenants_tenant_counters_id_inc2.cs deleted file mode 100644 index 6bf4f539f..000000000 --- a/src/Http/Wolverine.Http.Tests/Internal/Generated/WolverineHandlers/POST_api_tenants_tenant_counters_id_inc2.cs +++ /dev/null @@ -1,78 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Marten.Publishing; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_api_tenants_tenant_counters_id_inc2 - public class POST_api_tenants_tenant_counters_id_inc2 : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; - - public POST_api_tenants_tenant_counters_id_inc2(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _outboxedSessionFactory = outboxedSessionFactory; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - if (!System.Guid.TryParse((string)httpContext.GetRouteValue("id"), out var id)) - { - httpContext.Response.StatusCode = 404; - return; - } - - - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - // Building the Marten session - await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); - var counter = await documentSession.LoadAsync(id, httpContext.RequestAborted).ConfigureAwait(false); - // 404 if this required object is null - if (counter == null) - { - httpContext.Response.StatusCode = 404; - return; - } - - - // The actual HTTP request handler execution - var martenOp = Wolverine.Http.Tests.Bugs.CounterEndpoint.Increment2(counter); - - if (martenOp != null) - { - - // Placed by Wolverine's ISideEffect policy - martenOp.Execute(documentSession); - - } - - - // Commit any outstanding Marten changes - await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); - - - // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 - await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); - - // Wolverine automatically sets the status code to 204 for empty responses - if (!httpContext.Response.HasStarted) httpContext.Response.StatusCode = 204; - } - - } - - // END: POST_api_tenants_tenant_counters_id_inc2 - - -} - diff --git a/src/Http/Wolverine.Http.Tests/publishing_messages_from_middleware.cs b/src/Http/Wolverine.Http.Tests/publishing_messages_from_middleware.cs new file mode 100644 index 000000000..b7498bb12 --- /dev/null +++ b/src/Http/Wolverine.Http.Tests/publishing_messages_from_middleware.cs @@ -0,0 +1,36 @@ +using Alba; +using Shouldly; +using Wolverine.Tracking; +using WolverineWebApi; + +namespace Wolverine.Http.Tests; + +public class publishing_messages_from_middleware : IntegrationContext +{ + public publishing_messages_from_middleware(AppFixture fixture) : base(fixture) + { + } + + [Fact] + public async Task receive_messages_from_before_and_after_middleware() + { + Func execute = async c => + { + await Host.Scenario(x => + { + x.Post.Url("/middleware-messages/leia"); + }); + }; + + var tracked = await Host + .TrackActivity() + .WaitForMessageToBeReceivedAt(Host) + .ExecuteAndWaitAsync(execute); + + tracked.Received.SingleMessage() + .Name.ShouldBe("leia"); + + tracked.Received.SingleMessage() + .Name.ShouldBe("leia"); + } +} \ No newline at end of file diff --git a/src/Http/Wolverine.Http/HttpChain.Codegen.cs b/src/Http/Wolverine.Http/HttpChain.Codegen.cs index d11f2c6bd..cba17383a 100644 --- a/src/Http/Wolverine.Http/HttpChain.Codegen.cs +++ b/src/Http/Wolverine.Http/HttpChain.Codegen.cs @@ -11,6 +11,7 @@ using Wolverine.Http.CodeGen; using Wolverine.Http.Resources; using Wolverine.Logging; +using Wolverine.Persistence; using Wolverine.Runtime; using Wolverine.Runtime.Handlers; @@ -145,19 +146,19 @@ internal IEnumerable DetermineFrames(GenerationRules rules) .Select(x => x.ReturnAction(this)).SelectMany(x => x.Frames()).ToArray(); foreach (var frame in actionsOnOtherReturnValues) yield return frame; - foreach (var frame in Postprocessors) yield return frame; - - if (!Postprocessors.OfType().Any(x => - x.HandlerType == typeof(MessageContext) && - x.Method.Name == nameof(MessageContext.EnqueueCascadingAsync))) + if (Postprocessors.Any(x => x.MaySendMessages())) { - if (actionsOnOtherReturnValues.OfType().Any() && !Postprocessors.OfType().Any(x => x.Method.Name == nameof(MessageContext.FlushOutgoingMessagesAsync))) + var flush = Postprocessors.OfType().FirstOrDefault(); + if (flush != null) { - var flush = MethodCall.For(x => x.FlushOutgoingMessagesAsync()); - flush.CommentText = "Making sure there is at least one call to flush outgoing, cascading messages"; - yield return flush; + Postprocessors.Remove(flush); } + + flush ??= new FlushOutgoingMessages(); + Postprocessors.Add(flush); } + + foreach (var frame in Postprocessors) yield return frame; } private string determineFileName() diff --git a/src/Http/WolverineWebApi/CascadingEndpoint.cs b/src/Http/WolverineWebApi/CascadingEndpoint.cs new file mode 100644 index 000000000..5c10e5b0e --- /dev/null +++ b/src/Http/WolverineWebApi/CascadingEndpoint.cs @@ -0,0 +1,36 @@ +using System.Diagnostics; +using Marten; +using Wolverine; +using Wolverine.Attributes; +using Wolverine.Http; + +namespace WolverineWebApi; + +public static class CascadingEndpoint +{ + public static OutgoingMessages Before(string name) + { + return [new BeforeMessage1(name)]; + } + + [Transactional] + [WolverinePost("/middleware-messages/{name}")] + public static string Post(string name, IDocumentSession session) + { + return "Hey"; + } + + public static async Task After(IMessageBus bus, string name) + { + await bus.PublishAsync(new AfterMessage1(name)); + } +} + +public record BeforeMessage1(string Name); +public record AfterMessage1(string Name); + +public static class MiddlewareMessageHandler +{ + public static void Handle(BeforeMessage1 message) => Debug.WriteLine("Got " + message); + public static void Handle(AfterMessage1 message) => Debug.WriteLine("Got " + message); +} \ No newline at end of file diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/CustomRequestHandler1116913013.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/CustomRequestHandler1116913013.cs deleted file mode 100644 index 8e8595a12..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/CustomRequestHandler1116913013.cs +++ /dev/null @@ -1,32 +0,0 @@ -// -#pragma warning disable - -namespace Internal.Generated.WolverineHandlers -{ - // START: CustomRequestHandler1116913013 - public class CustomRequestHandler1116913013 : Wolverine.Runtime.Handlers.MessageHandler - { - - - public override async System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) - { - // The actual message body - var customRequest = (WolverineWebApi.CustomRequest)context.Envelope.Message; - - - // The actual message execution - var outgoing1 = WolverineWebApi.MessageHandler.Handle(customRequest); - - - // Outgoing, cascaded message - await context.EnqueueCascadingAsync(outgoing1).ConfigureAwait(false); - - } - - } - - // END: CustomRequestHandler1116913013 - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/DELETE_api_trainer.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/DELETE_api_trainer.cs deleted file mode 100644 index 6cc2eff4f..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/DELETE_api_trainer.cs +++ /dev/null @@ -1,56 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Marten.Publishing; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: DELETE_api_trainer - public class DELETE_api_trainer : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; - - public DELETE_api_trainer(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _outboxedSessionFactory = outboxedSessionFactory; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - // Building the Marten session - await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); - var userId = WolverineWebApi.UserIdMiddleware.LoadAsync(httpContext); - var trainerDelete = new WolverineWebApi.TrainerDelete(); - - // The actual HTTP request handler execution - var result = await trainerDelete.Delete(userId, documentSession, httpContext.RequestAborted).ConfigureAwait(false); - - - // Commit any outstanding Marten changes - await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); - - - // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 - await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); - - await result.ExecuteAsync(httpContext).ConfigureAwait(false); - } - - } - - // END: DELETE_api_trainer - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/DELETE_validate_user_compound.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/DELETE_validate_user_compound.cs deleted file mode 100644 index f2305e91b..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/DELETE_validate_user_compound.cs +++ /dev/null @@ -1,68 +0,0 @@ -// -#pragma warning disable -using FluentValidation; -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Http.FluentValidation; - -namespace Internal.Generated.WolverineHandlers -{ - // START: DELETE_validate_user_compound - public class DELETE_validate_user_compound : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Http.FluentValidation.IProblemDetailSource _problemDetailSource; - private readonly FluentValidation.IValidator _validator; - - public DELETE_validate_user_compound(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Http.FluentValidation.IProblemDetailSource problemDetailSource, FluentValidation.IValidator validator) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _problemDetailSource = problemDetailSource; - _validator = validator; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - // Reading the request body via JSON deserialization - var (cmd, jsonContinue) = await ReadJsonAsync(httpContext); - if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; - - // Execute FluentValidation validators - var result1 = await Wolverine.Http.FluentValidation.Internals.FluentValidationHttpExecutor.ExecuteOne(_validator, _problemDetailSource, cmd).ConfigureAwait(false); - - // Evaluate whether or not the execution should be stopped based on the IResult value - if (!(result1 is Wolverine.Http.WolverineContinue)) - { - await result1.ExecuteAsync(httpContext).ConfigureAwait(false); - return; - } - - - var user = WolverineWebApi.Validation.ValidatedCompoundEndpoint.Load(cmd); - var result2 = WolverineWebApi.Validation.ValidatedCompoundEndpoint.Validate(user); - // Evaluate whether or not the execution should be stopped based on the IResult value - if (!(result2 is Wolverine.Http.WolverineContinue)) - { - await result2.ExecuteAsync(httpContext).ConfigureAwait(false); - return; - } - - - - // The actual HTTP request handler execution - var result_of_Handle = WolverineWebApi.Validation.ValidatedCompoundEndpoint.Handle(cmd, user); - - await WriteString(httpContext, result_of_Handle); - } - - } - - // END: DELETE_validate_user_compound - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/DataHandler620835457.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/DataHandler620835457.cs deleted file mode 100644 index 9e0e701de..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/DataHandler620835457.cs +++ /dev/null @@ -1,30 +0,0 @@ -// -#pragma warning disable - -namespace Internal.Generated.WolverineHandlers -{ - // START: DataHandler620835457 - public class DataHandler620835457 : Wolverine.Runtime.Handlers.MessageHandler - { - - - public override System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) - { - // The actual message body - var data = (WolverineWebApi.Data)context.Envelope.Message; - - var dataHandler = new WolverineWebApi.DataHandler(); - - // The actual message execution - dataHandler.Handle(data); - - return System.Threading.Tasks.Task.CompletedTask; - } - - } - - // END: DataHandler620835457 - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_age_age.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_age_age.cs deleted file mode 100644 index 0d0d849db..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_age_age.cs +++ /dev/null @@ -1,45 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_age_age - public class GET_age_age : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public GET_age_age(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - if (!int.TryParse((string)httpContext.GetRouteValue("age"), out var age)) - { - httpContext.Response.StatusCode = 404; - return; - } - - - // Just saying hello in the code! Also testing the usage of attributes to customize endpoints - - // The actual HTTP request handler execution - var result_of_IntRouteArgument = WolverineWebApi.TestEndpoints.IntRouteArgument(age); - - await WriteString(httpContext, result_of_IntRouteArgument); - } - - } - - // END: GET_age_age - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_api_myapp_registration_price.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_api_myapp_registration_price.cs deleted file mode 100644 index 43d4d83e3..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_api_myapp_registration_price.cs +++ /dev/null @@ -1,40 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_api_myapp_registration_price - public class GET_api_myapp_registration_price : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public GET_api_myapp_registration_price(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - int numberOfMembers = default; - int.TryParse(httpContext.Request.Query["numberOfMembers"], System.Globalization.CultureInfo.InvariantCulture, out numberOfMembers); - - // The actual HTTP request handler execution - var decimalValue_response = WolverineWebApi.Bugs.MyAppLandingEndpoint.GetRegistrationPrice(numberOfMembers); - - // Writing the response body to JSON because this was the first 'return variable' in the method signature - await WriteJsonAsync(httpContext, decimalValue_response); - } - - } - - // END: GET_api_myapp_registration_price - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_correlation.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_correlation.cs deleted file mode 100644 index 2cbfc3e53..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_correlation.cs +++ /dev/null @@ -1,42 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_correlation - public class GET_correlation : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - - public GET_correlation(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - Wolverine.Http.Runtime.RequestIdMiddleware.Apply(httpContext, messageContext); - - // The actual HTTP request handler execution - var result_of_GetCorrelation = WolverineWebApi.TracingEndpoint.GetCorrelation(messageContext); - - await WriteString(httpContext, result_of_GetCorrelation); - } - - } - - // END: GET_correlation - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_data_id.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_data_id.cs deleted file mode 100644 index 6c6e7df3b..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_data_id.cs +++ /dev/null @@ -1,64 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Marten.Publishing; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_data_id - public class GET_data_id : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; - - public GET_data_id(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _outboxedSessionFactory = outboxedSessionFactory; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - // Building the Marten session - await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); - if (!System.Guid.TryParse((string)httpContext.GetRouteValue("id"), out var id)) - { - httpContext.Response.StatusCode = 404; - return; - } - - - // Just saying hello in the code! Also testing the usage of attributes to customize endpoints - var serviceEndpoints = new WolverineWebApi.ServiceEndpoints(); - - // The actual HTTP request handler execution - var data_response = await serviceEndpoints.GetData(id, documentSession).ConfigureAwait(false); - - - // Commit any outstanding Marten changes - await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); - - - // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 - await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); - - // Writing the response body to JSON because this was the first 'return variable' in the method signature - await WriteJsonAsync(httpContext, data_response); - } - - } - - // END: GET_data_id - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_discovered.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_discovered.cs deleted file mode 100644 index a2411a491..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_discovered.cs +++ /dev/null @@ -1,37 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_discovered - public class GET_discovered : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public GET_discovered(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - - // The actual HTTP request handler execution - var result_of_Get = WolverineWebApi.DiscoverMe.Get(); - - await WriteString(httpContext, result_of_Get); - } - - } - - // END: GET_discovered - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_document_required_document_attribute_only_id.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_document_required_document_attribute_only_id.cs deleted file mode 100644 index 13ba31b7c..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_document_required_document_attribute_only_id.cs +++ /dev/null @@ -1,79 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Marten.Publishing; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_document_required_document_attribute_only_id - public class GET_document_required_document_attribute_only_id : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; - - public GET_document_required_document_attribute_only_id(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _outboxedSessionFactory = outboxedSessionFactory; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - // Building the Marten session - await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); - if (!System.Guid.TryParse((string)httpContext.GetRouteValue("id"), out var id)) - { - httpContext.Response.StatusCode = 404; - return; - } - - - var invoice = await documentSession.LoadAsync(id, httpContext.RequestAborted).ConfigureAwait(false); - // 404 if this required object is null - if (invoice == null) - { - httpContext.Response.StatusCode = 404; - return; - } - - var problemDetails1 = WolverineWebApi.Marten.DocumentRequiredEndpoint.Load(invoice); - // Evaluate whether the processing should stop if there are any problems - if (!(ReferenceEquals(problemDetails1, Wolverine.Http.WolverineContinue.NoProblems))) - { - await WriteProblems(problemDetails1, httpContext).ConfigureAwait(false); - return; - } - - - - // The actual HTTP request handler execution - var invoice_response = WolverineWebApi.Marten.DocumentRequiredEndpoint.DocumentAttributeOnly(invoice); - - - // Commit any outstanding Marten changes - await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); - - - // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 - await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); - - // Writing the response body to JSON because this was the first 'return variable' in the method signature - await WriteJsonAsync(httpContext, invoice_response); - } - - } - - // END: GET_document_required_document_attribute_only_id - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_document_required_separate_attributes_id.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_document_required_separate_attributes_id.cs deleted file mode 100644 index 770e42fe8..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_document_required_separate_attributes_id.cs +++ /dev/null @@ -1,79 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Marten.Publishing; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_document_required_separate_attributes_id - public class GET_document_required_separate_attributes_id : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; - - public GET_document_required_separate_attributes_id(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _outboxedSessionFactory = outboxedSessionFactory; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - // Building the Marten session - await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); - if (!System.Guid.TryParse((string)httpContext.GetRouteValue("id"), out var id)) - { - httpContext.Response.StatusCode = 404; - return; - } - - - var invoice = await documentSession.LoadAsync(id, httpContext.RequestAborted).ConfigureAwait(false); - var problemDetails1 = WolverineWebApi.Marten.DocumentRequiredEndpoint.Load(invoice); - // Evaluate whether the processing should stop if there are any problems - if (!(ReferenceEquals(problemDetails1, Wolverine.Http.WolverineContinue.NoProblems))) - { - await WriteProblems(problemDetails1, httpContext).ConfigureAwait(false); - return; - } - - - // 404 if this required object is null - if (invoice == null) - { - httpContext.Response.StatusCode = 404; - return; - } - - - // The actual HTTP request handler execution - var invoice_response = WolverineWebApi.Marten.DocumentRequiredEndpoint.SeparateAttributes(invoice); - - - // Commit any outstanding Marten changes - await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); - - - // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 - await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); - - // Writing the response body to JSON because this was the first 'return variable' in the method signature - await WriteJsonAsync(httpContext, invoice_response); - } - - } - - // END: GET_document_required_separate_attributes_id - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_enum_direction.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_enum_direction.cs deleted file mode 100644 index f1f168d7f..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_enum_direction.cs +++ /dev/null @@ -1,45 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_enum_direction - public class GET_enum_direction : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public GET_enum_direction(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - if (!WolverineWebApi.Direction.TryParse((string)httpContext.GetRouteValue("direction"), true, out WolverineWebApi.Direction direction)) - { - httpContext.Response.StatusCode = 404; - return; - } - - - var fakeEndpoint = new WolverineWebApi.FakeEndpoint(); - - // The actual HTTP request handler execution - var result_of_ReadEnumArgument = fakeEndpoint.ReadEnumArgument(direction); - - await WriteString(httpContext, result_of_ReadEnumArgument); - } - - } - - // END: GET_enum_direction - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_headers_accepts.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_headers_accepts.cs deleted file mode 100644 index 3aad6da38..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_headers_accepts.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_headers_accepts - public class GET_headers_accepts : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public GET_headers_accepts(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - // Retrieve header value from the request - var accepts = ReadSingleHeaderValue(httpContext, "accepts"); - // Retrieve header value from the request - var day = ReadSingleHeaderValue(httpContext, "x-day"); - WolverineWebApi.HeaderUsingEndpoint.Before(day); - var headerUsingEndpoint = new WolverineWebApi.HeaderUsingEndpoint(); - - // The actual HTTP request handler execution - var result_of_GetETag = headerUsingEndpoint.GetETag(accepts); - - await WriteString(httpContext, result_of_GetETag); - } - - } - - // END: GET_headers_accepts - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_headers_int.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_headers_int.cs deleted file mode 100644 index 3bbb223a2..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_headers_int.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_headers_int - public class GET_headers_int : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public GET_headers_int(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - int number = default; - int.TryParse(ReadSingleHeaderValue(httpContext, "x-wolverine"), out number); - // Retrieve header value from the request - var day = ReadSingleHeaderValue(httpContext, "x-day"); - WolverineWebApi.HeaderUsingEndpoint.Before(day); - var headerUsingEndpoint = new WolverineWebApi.HeaderUsingEndpoint(); - - // The actual HTTP request handler execution - var result_of_Get = headerUsingEndpoint.Get(number); - - await WriteString(httpContext, result_of_Get); - } - - } - - // END: GET_headers_int - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_headers_simple.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_headers_simple.cs deleted file mode 100644 index 5fcbbf1b5..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_headers_simple.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_headers_simple - public class GET_headers_simple : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public GET_headers_simple(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - // Retrieve header value from the request - var name = ReadSingleHeaderValue(httpContext, "x-wolverine"); - // Retrieve header value from the request - var day = ReadSingleHeaderValue(httpContext, "x-day"); - WolverineWebApi.HeaderUsingEndpoint.Before(day); - var headerUsingEndpoint = new WolverineWebApi.HeaderUsingEndpoint(); - - // The actual HTTP request handler execution - var result_of_Get = headerUsingEndpoint.Get(name); - - await WriteString(httpContext, result_of_Get); - } - - } - - // END: GET_headers_simple - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_hello.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_hello.cs deleted file mode 100644 index 987d91b87..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_hello.cs +++ /dev/null @@ -1,38 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_hello - public class GET_hello : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public GET_hello(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - // Just saying hello in the code! Also testing the usage of attributes to customize endpoints - - // The actual HTTP request handler execution - var result_of_Speak = WolverineWebApi.TestEndpoints.Speak(); - - await WriteString(httpContext, result_of_Speak); - } - - } - - // END: GET_hello - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_context.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_context.cs deleted file mode 100644 index 44cdafa4a..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_context.cs +++ /dev/null @@ -1,40 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_http_context - public class GET_http_context : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public GET_http_context(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var httpContextEndpoints = new WolverineWebApi.HttpContextEndpoints(); - - // The actual HTTP request handler execution - httpContextEndpoints.UseHttpContext(httpContext); - - // Wolverine automatically sets the status code to 204 for empty responses - if (!httpContext.Response.HasStarted) httpContext.Response.StatusCode = 204; - return System.Threading.Tasks.Task.CompletedTask; - } - - } - - // END: GET_http_context - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_identifier.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_identifier.cs deleted file mode 100644 index 944bf1e44..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_identifier.cs +++ /dev/null @@ -1,38 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_http_identifier - public class GET_http_identifier : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public GET_http_identifier(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var httpContextEndpoints = new WolverineWebApi.HttpContextEndpoints(); - - // The actual HTTP request handler execution - var result_of_UseTraceIdentifier = httpContextEndpoints.UseTraceIdentifier(httpContext.TraceIdentifier); - - await WriteString(httpContext, result_of_UseTraceIdentifier); - } - - } - - // END: GET_http_identifier - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_principal.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_principal.cs deleted file mode 100644 index fcbbe54fc..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_principal.cs +++ /dev/null @@ -1,40 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_http_principal - public class GET_http_principal : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public GET_http_principal(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var httpContextEndpoints = new WolverineWebApi.HttpContextEndpoints(); - - // The actual HTTP request handler execution - httpContextEndpoints.UseClaimsPrincipal(httpContext.User); - - // Wolverine automatically sets the status code to 204 for empty responses - if (!httpContext.Response.HasStarted) httpContext.Response.StatusCode = 204; - return System.Threading.Tasks.Task.CompletedTask; - } - - } - - // END: GET_http_principal - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_request.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_request.cs deleted file mode 100644 index 5c5e89a84..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_request.cs +++ /dev/null @@ -1,40 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_http_request - public class GET_http_request : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public GET_http_request(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var httpContextEndpoints = new WolverineWebApi.HttpContextEndpoints(); - - // The actual HTTP request handler execution - httpContextEndpoints.UseHttpRequest(httpContext.Request); - - // Wolverine automatically sets the status code to 204 for empty responses - if (!httpContext.Response.HasStarted) httpContext.Response.StatusCode = 204; - return System.Threading.Tasks.Task.CompletedTask; - } - - } - - // END: GET_http_request - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_response.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_response.cs deleted file mode 100644 index a3ba0647d..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_http_response.cs +++ /dev/null @@ -1,40 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_http_response - public class GET_http_response : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public GET_http_response(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var httpContextEndpoints = new WolverineWebApi.HttpContextEndpoints(); - - // The actual HTTP request handler execution - httpContextEndpoints.UseHttpResponse(httpContext.Response); - - // Wolverine automatically sets the status code to 204 for empty responses - if (!httpContext.Response.HasStarted) httpContext.Response.StatusCode = 204; - return System.Threading.Tasks.Task.CompletedTask; - } - - } - - // END: GET_http_response - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_approved.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_approved.cs deleted file mode 100644 index 65138716b..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_approved.cs +++ /dev/null @@ -1,46 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Marten.Publishing; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_invoices_approved - public class GET_invoices_approved : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; - - public GET_invoices_approved(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _outboxedSessionFactory = outboxedSessionFactory; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - // Building the Marten session - await using var querySession = _outboxedSessionFactory.QuerySession(messageContext); - - // The actual HTTP request handler execution - var approvedInvoicedCompiledQuery = WolverineWebApi.Marten.InvoicesEndpoint.GetApproved(); - - await Marten.AspNetCore.QueryableExtensions.WriteArray>(querySession, approvedInvoicedCompiledQuery, httpContext, "application/json", 200).ConfigureAwait(false); - } - - } - - // END: GET_invoices_approved - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_compiled_count.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_compiled_count.cs deleted file mode 100644 index a8ceefd35..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_compiled_count.cs +++ /dev/null @@ -1,47 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Marten.Publishing; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_invoices_compiled_count - public class GET_invoices_compiled_count : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; - - public GET_invoices_compiled_count(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _outboxedSessionFactory = outboxedSessionFactory; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - // Building the Marten session - await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); - - // The actual HTTP request handler execution - var compiledCountQuery = WolverineWebApi.Marten.InvoicesEndpoint.GetCompiledCount(); - - var result_of_QueryAsync = await documentSession.QueryAsync(compiledCountQuery, httpContext.RequestAborted).ConfigureAwait(false); - await Wolverine.Http.HttpHandler.WriteString(httpContext, result_of_QueryAsync.ToString()).ConfigureAwait(false); - } - - } - - // END: GET_invoices_compiled_count - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_compiled_id.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_compiled_id.cs deleted file mode 100644 index 5693010b6..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_compiled_id.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Marten.Publishing; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_invoices_compiled_id - public class GET_invoices_compiled_id : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; - - public GET_invoices_compiled_id(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _outboxedSessionFactory = outboxedSessionFactory; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - // Building the Marten session - await using var querySession = _outboxedSessionFactory.QuerySession(messageContext); - if (!System.Guid.TryParse((string)httpContext.GetRouteValue("id"), out var id)) - { - httpContext.Response.StatusCode = 404; - return; - } - - - - // The actual HTTP request handler execution - var byIdCompiled = WolverineWebApi.Marten.InvoicesEndpoint.GetCompiled(id); - - await Marten.AspNetCore.QueryableExtensions.WriteOne(querySession, byIdCompiled, httpContext, "application/json", 200).ConfigureAwait(false); - } - - } - - // END: GET_invoices_compiled_id - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_id.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_id.cs deleted file mode 100644 index eea79b7b3..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_id.cs +++ /dev/null @@ -1,70 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Marten.Publishing; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_invoices_id - public class GET_invoices_id : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; - - public GET_invoices_id(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _outboxedSessionFactory = outboxedSessionFactory; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - // Building the Marten session - await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); - if (!System.Guid.TryParse((string)httpContext.GetRouteValue("id"), out var id)) - { - httpContext.Response.StatusCode = 404; - return; - } - - - var invoice = await documentSession.LoadAsync(id, httpContext.RequestAborted).ConfigureAwait(false); - // 404 if this required object is null - if (invoice == null) - { - httpContext.Response.StatusCode = 404; - return; - } - - - // The actual HTTP request handler execution - var invoice_response = WolverineWebApi.Marten.InvoicesEndpoint.Get(invoice); - - - // Commit any outstanding Marten changes - await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); - - - // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 - await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); - - // Writing the response body to JSON because this was the first 'return variable' in the method signature - await WriteJsonAsync(httpContext, invoice_response); - } - - } - - // END: GET_invoices_id - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_soft_delete_id.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_soft_delete_id.cs deleted file mode 100644 index 2d964ab0a..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_invoices_soft_delete_id.cs +++ /dev/null @@ -1,79 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Marten.Publishing; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_invoices_soft_delete_id - public class GET_invoices_soft_delete_id : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; - - public GET_invoices_soft_delete_id(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _outboxedSessionFactory = outboxedSessionFactory; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - if (!System.Guid.TryParse((string)httpContext.GetRouteValue("id"), out var id)) - { - httpContext.Response.StatusCode = 404; - return; - } - - - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - // Building the Marten session - await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); - var invoice = await documentSession.LoadAsync(id, httpContext.RequestAborted).ConfigureAwait(false); - // If the document is soft deleted, set the variable to null - var invoiceMetadata = invoice != null - ? await documentSession.MetadataForAsync(invoice).ConfigureAwait(false) - : null; - if (invoiceMetadata?.Deleted == true) - { - invoice = null; - } - - // 404 if this required object is null - if (invoice == null) - { - httpContext.Response.StatusCode = 404; - return; - } - - - // The actual HTTP request handler execution - var invoice_response = WolverineWebApi.Marten.InvoicesEndpoint.GetSoftDeleted(invoice); - - - // Commit any outstanding Marten changes - await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); - - - // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 - await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); - - // Writing the response body to JSON because this was the first 'return variable' in the method signature - await WriteJsonAsync(httpContext, invoice_response); - } - - } - - // END: GET_invoices_soft_delete_id - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_message_message.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_message_message.cs deleted file mode 100644 index def329788..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_message_message.cs +++ /dev/null @@ -1,42 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using WolverineWebApi; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_message_message - public class GET_message_message : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly WolverineWebApi.Recorder _recorder; - - public GET_message_message(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, WolverineWebApi.Recorder recorder) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _recorder = recorder; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var message = (string)httpContext.GetRouteValue("message"); - var serviceEndpoints = new WolverineWebApi.ServiceEndpoints(); - - // The actual HTTP request handler execution - var result_of_GetMessage = serviceEndpoints.GetMessage(message, _recorder); - - await WriteString(httpContext, result_of_GetMessage); - } - - } - - // END: GET_message_message - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_middleware_intrinsic.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_middleware_intrinsic.cs deleted file mode 100644 index 901fe1e60..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_middleware_intrinsic.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using WolverineWebApi; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_middleware_intrinsic - public class GET_middleware_intrinsic : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly WolverineWebApi.Recorder _recorder; - - public GET_middleware_intrinsic(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, WolverineWebApi.Recorder recorder) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _recorder = recorder; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - WolverineWebApi.BeforeAndAfterEndpoint.Before(_recorder); - var beforeAndAfterEndpoint = new WolverineWebApi.BeforeAndAfterEndpoint(); - - // The actual HTTP request handler execution - var result_of_GetRequest = beforeAndAfterEndpoint.GetRequest(_recorder); - - WolverineWebApi.BeforeAndAfterEndpoint.After(_recorder); - await WriteString(httpContext, result_of_GetRequest); - } - - } - - // END: GET_middleware_intrinsic - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_middleware_simple.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_middleware_simple.cs deleted file mode 100644 index ad97a7b02..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_middleware_simple.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using WolverineWebApi; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_middleware_simple - public class GET_middleware_simple : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly WolverineWebApi.Recorder _recorder; - - public GET_middleware_simple(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, WolverineWebApi.Recorder recorder) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _recorder = recorder; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - WolverineWebApi.BeforeAndAfterMiddleware.Before(_recorder); - var middlewareEndpoints = new WolverineWebApi.MiddlewareEndpoints(); - - // The actual HTTP request handler execution - var result_of_GetRequest = middlewareEndpoints.GetRequest(_recorder); - - WolverineWebApi.BeforeAndAfterMiddleware.After(_recorder); - await WriteString(httpContext, result_of_GetRequest); - } - - } - - // END: GET_middleware_simple - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_name_name.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_name_name.cs deleted file mode 100644 index 94d53159a..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_name_name.cs +++ /dev/null @@ -1,39 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_name_name - public class GET_name_name : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public GET_name_name(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var name = (string)httpContext.GetRouteValue("name"); - // Just saying hello in the code! Also testing the usage of attributes to customize endpoints - - // The actual HTTP request handler execution - var result_of_SimpleStringRouteArgument = WolverineWebApi.TestEndpoints.SimpleStringRouteArgument(name); - - await WriteString(httpContext, result_of_SimpleStringRouteArgument); - } - - } - - // END: GET_name_name - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_collection_enum.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_collection_enum.cs deleted file mode 100644 index b158e1da7..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_collection_enum.cs +++ /dev/null @@ -1,47 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_querystring_collection_enum - public class GET_querystring_collection_enum : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public GET_querystring_collection_enum(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var collection = new System.Collections.Generic.List(); - foreach (var collectionValue in httpContext.Request.Query["collection"]) - { - if (WolverineWebApi.Direction.TryParse(collectionValue, out var collectionValueParsed)) - { - collection.Add(collectionValueParsed); - } - - } - - - // The actual HTTP request handler execution - var result_of_UsingEnumCollection = WolverineWebApi.QuerystringCollectionEndpoints.UsingEnumCollection(collection); - - await WriteString(httpContext, result_of_UsingEnumCollection); - } - - } - - // END: GET_querystring_collection_enum - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_collection_guid.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_collection_guid.cs deleted file mode 100644 index 0baadddce..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_collection_guid.cs +++ /dev/null @@ -1,47 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_querystring_collection_guid - public class GET_querystring_collection_guid : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public GET_querystring_collection_guid(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var collection = new System.Collections.Generic.List(); - foreach (var collectionValue in httpContext.Request.Query["collection"]) - { - if (System.Guid.TryParse(collectionValue, System.Globalization.CultureInfo.InvariantCulture, out var collectionValueParsed)) - { - collection.Add(collectionValueParsed); - } - - } - - - // The actual HTTP request handler execution - var result_of_UsingGuidCollection = WolverineWebApi.QuerystringCollectionEndpoints.UsingGuidCollection(collection); - - await WriteString(httpContext, result_of_UsingGuidCollection); - } - - } - - // END: GET_querystring_collection_guid - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_collection_int.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_collection_int.cs deleted file mode 100644 index abbcd70ec..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_collection_int.cs +++ /dev/null @@ -1,47 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_querystring_collection_int - public class GET_querystring_collection_int : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public GET_querystring_collection_int(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var collection = new System.Collections.Generic.List(); - foreach (var collectionValue in httpContext.Request.Query["collection"]) - { - if (int.TryParse(collectionValue, System.Globalization.CultureInfo.InvariantCulture, out var collectionValueParsed)) - { - collection.Add(collectionValueParsed); - } - - } - - - // The actual HTTP request handler execution - var result_of_UsingIntCollection = WolverineWebApi.QuerystringCollectionEndpoints.UsingIntCollection(collection); - - await WriteString(httpContext, result_of_UsingIntCollection); - } - - } - - // END: GET_querystring_collection_int - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_collection_string.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_collection_string.cs deleted file mode 100644 index fa94b12c1..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_collection_string.cs +++ /dev/null @@ -1,39 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_querystring_collection_string - public class GET_querystring_collection_string : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public GET_querystring_collection_string(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var collection = new System.Collections.Generic.List(); - collection.AddRange(httpContext.Request.Query["collection"]); - - // The actual HTTP request handler execution - var result_of_UsingStringCollection = WolverineWebApi.QuerystringCollectionEndpoints.UsingStringCollection(collection); - - await WriteString(httpContext, result_of_UsingStringCollection); - } - - } - - // END: GET_querystring_collection_string - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_decimal.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_decimal.cs deleted file mode 100644 index b352a57f9..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_decimal.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using WolverineWebApi; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_querystring_decimal - public class GET_querystring_decimal : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly WolverineWebApi.Recorder _recorder; - - public GET_querystring_decimal(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, WolverineWebApi.Recorder recorder) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _recorder = recorder; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - System.Decimal amount = default; - System.Decimal.TryParse(httpContext.Request.Query["amount"], System.Globalization.CultureInfo.InvariantCulture, out amount); - // Just saying hello in the code! Also testing the usage of attributes to customize endpoints - - // The actual HTTP request handler execution - var result_of_UseQueryStringParsing = WolverineWebApi.TestEndpoints.UseQueryStringParsing(_recorder, amount); - - await WriteString(httpContext, result_of_UseQueryStringParsing); - } - - } - - // END: GET_querystring_decimal - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_enum.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_enum.cs deleted file mode 100644 index 3f6cd8e62..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_enum.cs +++ /dev/null @@ -1,39 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_querystring_enum - public class GET_querystring_enum : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public GET_querystring_enum(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - WolverineWebApi.Direction direction = default; - WolverineWebApi.Direction.TryParse(httpContext.Request.Query["direction"], out direction); - - // The actual HTTP request handler execution - var result_of_UsingEnumQuerystring = WolverineWebApi.QuerystringEndpoints.UsingEnumQuerystring(direction); - - await WriteString(httpContext, result_of_UsingEnumQuerystring); - } - - } - - // END: GET_querystring_enum - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_explicit.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_explicit.cs deleted file mode 100644 index 0c717e5d8..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_explicit.cs +++ /dev/null @@ -1,38 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_querystring_explicit - public class GET_querystring_explicit : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public GET_querystring_explicit(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - string name = httpContext.Request.Query["name"].FirstOrDefault(); - - // The actual HTTP request handler execution - var result_of_UsingEnumQuerystring = WolverineWebApi.QuerystringEndpoints.UsingEnumQuerystring(name); - - await WriteString(httpContext, result_of_UsingEnumQuerystring); - } - - } - - // END: GET_querystring_explicit - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_int.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_int.cs deleted file mode 100644 index 323321c85..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_int.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using WolverineWebApi; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_querystring_int - public class GET_querystring_int : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly WolverineWebApi.Recorder _recorder; - - public GET_querystring_int(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, WolverineWebApi.Recorder recorder) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _recorder = recorder; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - int? age = null; - if (int.TryParse(httpContext.Request.Query["age"], System.Globalization.CultureInfo.InvariantCulture, out var ageParsed)) age = ageParsed; - // Just saying hello in the code! Also testing the usage of attributes to customize endpoints - - // The actual HTTP request handler execution - var result_of_UsingQueryStringParsing = WolverineWebApi.TestEndpoints.UsingQueryStringParsing(_recorder, age); - - await WriteString(httpContext, result_of_UsingQueryStringParsing); - } - - } - - // END: GET_querystring_int - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_int_nullable.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_int_nullable.cs deleted file mode 100644 index 5f57729e4..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_int_nullable.cs +++ /dev/null @@ -1,40 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_querystring_int_nullable - public class GET_querystring_int_nullable : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public GET_querystring_int_nullable(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - int? age = null; - if (int.TryParse(httpContext.Request.Query["age"], System.Globalization.CultureInfo.InvariantCulture, out var ageParsed)) age = ageParsed; - // Just saying hello in the code! Also testing the usage of attributes to customize endpoints - - // The actual HTTP request handler execution - var result_of_UsingQueryStringParsingNullable = WolverineWebApi.TestEndpoints.UsingQueryStringParsingNullable(age); - - await WriteString(httpContext, result_of_UsingQueryStringParsingNullable); - } - - } - - // END: GET_querystring_int_nullable - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_string.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_string.cs deleted file mode 100644 index 44e55e0d6..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_querystring_string.cs +++ /dev/null @@ -1,39 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_querystring_string - public class GET_querystring_string : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public GET_querystring_string(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - string name = httpContext.Request.Query["name"].FirstOrDefault(); - // Just saying hello in the code! Also testing the usage of attributes to customize endpoints - - // The actual HTTP request handler execution - var result_of_UsingQueryString = WolverineWebApi.TestEndpoints.UsingQueryString(name); - - await WriteString(httpContext, result_of_UsingQueryString); - } - - } - - // END: GET_querystring_string - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_result.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_result.cs deleted file mode 100644 index 5f34df967..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_result.cs +++ /dev/null @@ -1,37 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_result - public class GET_result : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public GET_result(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - - // The actual HTTP request handler execution - var result = WolverineWebApi.ResultEndpoints.GetResult(); - - return result.ExecuteAsync(httpContext); - } - - } - - // END: GET_result - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_result_async.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_result_async.cs deleted file mode 100644 index 19eacbc71..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_result_async.cs +++ /dev/null @@ -1,37 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_result_async - public class GET_result_async : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public GET_result_async(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - - // The actual HTTP request handler execution - var result = await WolverineWebApi.ResultEndpoints.GetAsyncResult().ConfigureAwait(false); - - await result.ExecuteAsync(httpContext).ConfigureAwait(false); - } - - } - - // END: GET_result_async - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_results_static.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_results_static.cs deleted file mode 100644 index 2d8d30c43..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_results_static.cs +++ /dev/null @@ -1,39 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_results_static - public class GET_results_static : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public GET_results_static(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - // Just saying hello in the code! Also testing the usage of attributes to customize endpoints - - // The actual HTTP request handler execution - var arithmeticResults_response = WolverineWebApi.TestEndpoints.FetchStaticResults(); - - // Writing the response body to JSON because this was the first 'return variable' in the method signature - await WriteJsonAsync(httpContext, arithmeticResults_response); - } - - } - - // END: GET_results_static - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_trace.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_trace.cs deleted file mode 100644 index cb5c68d09..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_trace.cs +++ /dev/null @@ -1,38 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_trace - public class GET_trace : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public GET_trace(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var traceEndpoint = new WolverineWebApi.TraceEndpoint(); - - // The actual HTTP request handler execution - var result_of_Hey = traceEndpoint.Hey(); - - await WriteString(httpContext, result_of_Hey); - } - - } - - // END: GET_trace - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_wildcard_name.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_wildcard_name.cs deleted file mode 100644 index 3938ff58c..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_wildcard_name.cs +++ /dev/null @@ -1,39 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_wildcard_name - public class GET_wildcard_name : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public GET_wildcard_name(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var name = (string)httpContext.GetRouteValue("name"); - var wildcardEndpoint = new WolverineWebApi.WildcardEndpoint(); - - // The actual HTTP request handler execution - var result_of_Wildcard = wildcardEndpoint.Wildcard(name); - - await WriteString(httpContext, result_of_Wildcard); - } - - } - - // END: GET_wildcard_name - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_write_to_id.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_write_to_id.cs deleted file mode 100644 index 01df1d3c7..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_write_to_id.cs +++ /dev/null @@ -1,54 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Marten.Publishing; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: GET_write_to_id - public class GET_write_to_id : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; - - public GET_write_to_id(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _outboxedSessionFactory = outboxedSessionFactory; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - // Building the Marten session - await using var querySession = _outboxedSessionFactory.QuerySession(messageContext); - if (!System.Guid.TryParse((string)httpContext.GetRouteValue("id"), out var id)) - { - httpContext.Response.StatusCode = 404; - return; - } - - - - // The actual HTTP request handler execution - await WolverineWebApi.WriteToEndpoints.GetAssetCodeView(id, querySession, httpContext).ConfigureAwait(false); - - // Wolverine automatically sets the status code to 204 for empty responses - if (!httpContext.Response.HasStarted) httpContext.Response.StatusCode = 204; - } - - } - - // END: GET_write_to_id - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage1Handler862252953.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage1Handler862252953.cs deleted file mode 100644 index 28ebbeaae..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage1Handler862252953.cs +++ /dev/null @@ -1,29 +0,0 @@ -// -#pragma warning disable - -namespace Internal.Generated.WolverineHandlers -{ - // START: HttpMessage1Handler862252953 - public class HttpMessage1Handler862252953 : Wolverine.Runtime.Handlers.MessageHandler - { - - - public override System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) - { - // The actual message body - var httpMessage1 = (WolverineWebApi.HttpMessage1)context.Envelope.Message; - - - // The actual message execution - WolverineWebApi.MessageHandler.Handle(httpMessage1); - - return System.Threading.Tasks.Task.CompletedTask; - } - - } - - // END: HttpMessage1Handler862252953 - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage2Handler1265537480.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage2Handler1265537480.cs deleted file mode 100644 index 3bf1a85a0..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage2Handler1265537480.cs +++ /dev/null @@ -1,29 +0,0 @@ -// -#pragma warning disable - -namespace Internal.Generated.WolverineHandlers -{ - // START: HttpMessage2Handler1265537480 - public class HttpMessage2Handler1265537480 : Wolverine.Runtime.Handlers.MessageHandler - { - - - public override System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) - { - // The actual message body - var httpMessage2 = (WolverineWebApi.HttpMessage2)context.Envelope.Message; - - - // The actual message execution - WolverineWebApi.MessageHandler.Handle(httpMessage2); - - return System.Threading.Tasks.Task.CompletedTask; - } - - } - - // END: HttpMessage2Handler1265537480 - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage3Handler300546461.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage3Handler300546461.cs deleted file mode 100644 index 06ecc2c1f..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage3Handler300546461.cs +++ /dev/null @@ -1,29 +0,0 @@ -// -#pragma warning disable - -namespace Internal.Generated.WolverineHandlers -{ - // START: HttpMessage3Handler300546461 - public class HttpMessage3Handler300546461 : Wolverine.Runtime.Handlers.MessageHandler - { - - - public override System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) - { - // The actual message body - var httpMessage3 = (WolverineWebApi.HttpMessage3)context.Envelope.Message; - - - // The actual message execution - WolverineWebApi.MessageHandler.Handle(httpMessage3); - - return System.Threading.Tasks.Task.CompletedTask; - } - - } - - // END: HttpMessage3Handler300546461 - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage4Handler102738066.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage4Handler102738066.cs deleted file mode 100644 index aca0165db..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage4Handler102738066.cs +++ /dev/null @@ -1,29 +0,0 @@ -// -#pragma warning disable - -namespace Internal.Generated.WolverineHandlers -{ - // START: HttpMessage4Handler102738066 - public class HttpMessage4Handler102738066 : Wolverine.Runtime.Handlers.MessageHandler - { - - - public override System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) - { - // The actual message body - var httpMessage4 = (WolverineWebApi.HttpMessage4)context.Envelope.Message; - - - // The actual message execution - WolverineWebApi.MessageHandler.Handle(httpMessage4); - - return System.Threading.Tasks.Task.CompletedTask; - } - - } - - // END: HttpMessage4Handler102738066 - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage5Handler1463345875.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage5Handler1463345875.cs deleted file mode 100644 index 6603c853c..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/HttpMessage5Handler1463345875.cs +++ /dev/null @@ -1,29 +0,0 @@ -// -#pragma warning disable - -namespace Internal.Generated.WolverineHandlers -{ - // START: HttpMessage5Handler1463345875 - public class HttpMessage5Handler1463345875 : Wolverine.Runtime.Handlers.MessageHandler - { - - - public override System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) - { - // The actual message body - var httpMessage5 = (WolverineWebApi.HttpMessage5)context.Envelope.Message; - - - // The actual message execution - WolverineWebApi.MessageHandler.Handle(httpMessage5); - - return System.Threading.Tasks.Task.CompletedTask; - } - - } - - // END: HttpMessage5Handler1463345875 - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/ItemCreatedHandler179438836.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/ItemCreatedHandler179438836.cs deleted file mode 100644 index fd749a55d..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/ItemCreatedHandler179438836.cs +++ /dev/null @@ -1,30 +0,0 @@ -// -#pragma warning disable - -namespace Internal.Generated.WolverineHandlers -{ - // START: ItemCreatedHandler179438836 - public class ItemCreatedHandler179438836 : Wolverine.Runtime.Handlers.MessageHandler - { - - - public override System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) - { - // The actual message body - var itemCreated = (WolverineWebApi.ItemCreated)context.Envelope.Message; - - var itemCreatedHandler = new WolverineWebApi.ItemCreatedHandler(); - - // The actual message execution - itemCreatedHandler.Handle(itemCreated); - - return System.Threading.Tasks.Task.CompletedTask; - } - - } - - // END: ItemCreatedHandler179438836 - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/MessageThatAlwaysGoesToDeadLetterHandler1388008025.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/MessageThatAlwaysGoesToDeadLetterHandler1388008025.cs deleted file mode 100644 index ceb80a058..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/MessageThatAlwaysGoesToDeadLetterHandler1388008025.cs +++ /dev/null @@ -1,29 +0,0 @@ -// -#pragma warning disable - -namespace Internal.Generated.WolverineHandlers -{ - // START: MessageThatAlwaysGoesToDeadLetterHandler1388008025 - public class MessageThatAlwaysGoesToDeadLetterHandler1388008025 : Wolverine.Runtime.Handlers.MessageHandler - { - - - public override System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) - { - // The actual message body - var messageThatAlwaysGoesToDeadLetter = (WolverineWebApi.MessageThatAlwaysGoesToDeadLetter)context.Envelope.Message; - - - // The actual message execution - WolverineWebApi.MessageHandler.Handle(messageThatAlwaysGoesToDeadLetter); - - return System.Threading.Tasks.Task.CompletedTask; - } - - } - - // END: MessageThatAlwaysGoesToDeadLetterHandler1388008025 - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/NumberMessageHandler722393759.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/NumberMessageHandler722393759.cs deleted file mode 100644 index 6feb4c0a8..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/NumberMessageHandler722393759.cs +++ /dev/null @@ -1,45 +0,0 @@ -// -#pragma warning disable -using Microsoft.Extensions.Logging; - -namespace Internal.Generated.WolverineHandlers -{ - // START: NumberMessageHandler722393759 - public class NumberMessageHandler722393759 : Wolverine.Runtime.Handlers.MessageHandler - { - private readonly Microsoft.Extensions.Logging.ILogger _loggerForMessage; - - public NumberMessageHandler722393759(Microsoft.Extensions.Logging.ILogger loggerForMessage) - { - _loggerForMessage = loggerForMessage; - } - - - - public override async System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) - { - // The actual message body - var numberMessage = (WolverineWebApi.NumberMessage)context.Envelope.Message; - - var problemDetails = WolverineWebApi.NumberMessageHandler.Validate(numberMessage); - // Evaluate whether the processing should stop if there are any problems - if (!(ReferenceEquals(problemDetails, Wolverine.Http.WolverineContinue.NoProblems))) - { - Wolverine.Http.CodeGen.ProblemDetailsContinuationPolicy.WriteProblems(((Microsoft.Extensions.Logging.ILogger)_loggerForMessage), problemDetails); - return; - } - - - - // The actual message execution - WolverineWebApi.NumberMessageHandler.Handle(numberMessage); - - } - - } - - // END: NumberMessageHandler722393759 - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_authenticated.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_authenticated.cs deleted file mode 100644 index f0abe9d76..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_authenticated.cs +++ /dev/null @@ -1,51 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_authenticated - public class POST_authenticated : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public POST_authenticated(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var fakeAuthenticationMiddleware = new WolverineWebApi.FakeAuthenticationMiddleware(); - // Reading the request body via JSON deserialization - var (request, jsonContinue) = await ReadJsonAsync(httpContext); - if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; - var result1 = WolverineWebApi.FakeAuthenticationMiddleware.Before(request); - // Evaluate whether or not the execution should be stopped based on the IResult value - if (!(result1 is Wolverine.Http.WolverineContinue)) - { - await result1.ExecuteAsync(httpContext).ConfigureAwait(false); - return; - } - - - var authenticatedEndpoint = new WolverineWebApi.AuthenticatedEndpoint(); - - // The actual HTTP request handler execution - var result_of_Get = authenticatedEndpoint.Get(request); - - await WriteString(httpContext, result_of_Get); - } - - } - - // END: POST_authenticated - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_convert_book.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_convert_book.cs deleted file mode 100644 index 97d418220..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_convert_book.cs +++ /dev/null @@ -1,46 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_convert_book - public class POST_convert_book : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - - public POST_convert_book(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - Wolverine.Http.Runtime.RequestIdMiddleware.Apply(httpContext, messageContext); - // Reading the request body via JSON deserialization - var (@event, jsonContinue) = await ReadJsonAsync(httpContext); - if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; - - // The actual HTTP request handler execution - await WolverineWebApi.Bugs.ConvertBookEndpoint.Post(@event, messageContext, httpContext.RequestAborted).ConfigureAwait(false); - - // Wolverine automatically sets the status code to 204 for empty responses - if (!httpContext.Response.HasStarted) httpContext.Response.StatusCode = 204; - } - - } - - // END: POST_convert_book - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_ef_create.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_ef_create.cs deleted file mode 100644 index c26496666..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_ef_create.cs +++ /dev/null @@ -1,60 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using Microsoft.EntityFrameworkCore; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_ef_create - public class POST_ef_create : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Microsoft.EntityFrameworkCore.DbContextOptions _dbContextOptions; - - public POST_ef_create(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Microsoft.EntityFrameworkCore.DbContextOptions dbContextOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _dbContextOptions = dbContextOptions; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var itemsDbContext = new WolverineWebApi.ItemsDbContext(_dbContextOptions); - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - - // Enroll the DbContext & IMessagingContext in the outgoing Wolverine outbox transaction - var envelopeTransaction = Wolverine.EntityFrameworkCore.WolverineEntityCoreExtensions.BuildTransaction(itemsDbContext, messageContext); - await messageContext.EnlistInOutboxAsync(envelopeTransaction); - // Reading the request body via JSON deserialization - var (command, jsonContinue) = await ReadJsonAsync(httpContext); - if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; - var efCoreEndpoints = new WolverineWebApi.EfCoreEndpoints(); - - // The actual HTTP request handler execution - efCoreEndpoints.CreateItem(command, itemsDbContext); - - - // Added by EF Core Transaction Middleware - var result_of_SaveChangesAsync = await itemsDbContext.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); - - // If we have separate context for outbox and application, then we need to manually commit the transaction - if (envelopeTransaction is Wolverine.EntityFrameworkCore.Internals.RawDatabaseEnvelopeTransaction rawTx) { await rawTx.CommitAsync(); } - // Wolverine automatically sets the status code to 204 for empty responses - if (!httpContext.Response.HasStarted) httpContext.Response.StatusCode = 204; - } - - } - - // END: POST_ef_create - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_ef_publish.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_ef_publish.cs deleted file mode 100644 index 3727285eb..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_ef_publish.cs +++ /dev/null @@ -1,62 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using Microsoft.EntityFrameworkCore; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_ef_publish - public class POST_ef_publish : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Microsoft.EntityFrameworkCore.DbContextOptions _dbContextOptions; - - public POST_ef_publish(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Microsoft.EntityFrameworkCore.DbContextOptions dbContextOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _dbContextOptions = dbContextOptions; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var itemsDbContext = new WolverineWebApi.ItemsDbContext(_dbContextOptions); - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - Wolverine.Http.Runtime.RequestIdMiddleware.Apply(httpContext, messageContext); - - // Enroll the DbContext & IMessagingContext in the outgoing Wolverine outbox transaction - var envelopeTransaction = Wolverine.EntityFrameworkCore.WolverineEntityCoreExtensions.BuildTransaction(itemsDbContext, messageContext); - await messageContext.EnlistInOutboxAsync(envelopeTransaction); - // Reading the request body via JSON deserialization - var (command, jsonContinue) = await ReadJsonAsync(httpContext); - if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; - var efCoreEndpoints = new WolverineWebApi.EfCoreEndpoints(); - - // The actual HTTP request handler execution - await efCoreEndpoints.PublishItem(command, itemsDbContext, messageContext).ConfigureAwait(false); - - - // Added by EF Core Transaction Middleware - var result_of_SaveChangesAsync = await itemsDbContext.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); - - // If we have separate context for outbox and application, then we need to manually commit the transaction - if (envelopeTransaction is Wolverine.EntityFrameworkCore.Internals.RawDatabaseEnvelopeTransaction rawTx) { await rawTx.CommitAsync(); } - await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); - // Wolverine automatically sets the status code to 204 for empty responses - if (!httpContext.Response.HasStarted) httpContext.Response.StatusCode = 204; - } - - } - - // END: POST_ef_publish - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_fromservices.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_fromservices.cs deleted file mode 100644 index 2c8e7e3bb..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_fromservices.cs +++ /dev/null @@ -1,41 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using WolverineWebApi; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_fromservices - public class POST_fromservices : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly WolverineWebApi.Recorder _recorder; - - public POST_fromservices(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, WolverineWebApi.Recorder recorder) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _recorder = recorder; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var attributeEndpoints = new WolverineWebApi.AttributeEndpoints(); - - // The actual HTTP request handler execution - var result_of_PostFromServices = attributeEndpoints.PostFromServices(_recorder); - - await WriteString(httpContext, result_of_PostFromServices); - } - - } - - // END: POST_fromservices - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_invoices_invoiceId_pay.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_invoices_invoiceId_pay.cs deleted file mode 100644 index 90113ad84..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_invoices_invoiceId_pay.cs +++ /dev/null @@ -1,78 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Marten.Publishing; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_invoices_invoiceId_pay - public class POST_invoices_invoiceId_pay : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; - - public POST_invoices_invoiceId_pay(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _outboxedSessionFactory = outboxedSessionFactory; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - // Building the Marten session - await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); - if (!System.Guid.TryParse((string)httpContext.GetRouteValue("invoiceId"), out var invoiceId)) - { - httpContext.Response.StatusCode = 404; - return; - } - - - var invoice = await documentSession.LoadAsync(invoiceId, httpContext.RequestAborted).ConfigureAwait(false); - // 404 if this required object is null - if (invoice == null) - { - httpContext.Response.StatusCode = 404; - return; - } - - - // The actual HTTP request handler execution - var martenOp = WolverineWebApi.Marten.InvoicesEndpoint.Pay(invoice); - - if (martenOp != null) - { - - // Placed by Wolverine's ISideEffect policy - martenOp.Execute(documentSession); - - } - - - // Commit any outstanding Marten changes - await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); - - - // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 - await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); - - // Wolverine automatically sets the status code to 204 for empty responses - if (!httpContext.Response.HasStarted) httpContext.Response.StatusCode = 204; - } - - } - - // END: POST_invoices_invoiceId_pay - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_invoices_number_approve.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_invoices_number_approve.cs deleted file mode 100644 index 42db92ee7..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_invoices_number_approve.cs +++ /dev/null @@ -1,78 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Marten.Publishing; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_invoices_number_approve - public class POST_invoices_number_approve : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; - - public POST_invoices_number_approve(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _outboxedSessionFactory = outboxedSessionFactory; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - // Building the Marten session - await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); - if (!System.Guid.TryParse((string)httpContext.GetRouteValue("number"), out var number)) - { - httpContext.Response.StatusCode = 404; - return; - } - - - var invoice = await documentSession.LoadAsync(number, httpContext.RequestAborted).ConfigureAwait(false); - // 404 if this required object is null - if (invoice == null) - { - httpContext.Response.StatusCode = 404; - return; - } - - - // The actual HTTP request handler execution - var martenOp = WolverineWebApi.Marten.InvoicesEndpoint.Approve(invoice); - - if (martenOp != null) - { - - // Placed by Wolverine's ISideEffect policy - martenOp.Execute(documentSession); - - } - - - // Commit any outstanding Marten changes - await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); - - - // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 - await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); - - // Wolverine automatically sets the status code to 204 for empty responses - if (!httpContext.Response.HasStarted) httpContext.Response.StatusCode = 204; - } - - } - - // END: POST_invoices_number_approve - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_issue.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_issue.cs deleted file mode 100644 index fff51cdcd..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_issue.cs +++ /dev/null @@ -1,69 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Marten.Publishing; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_issue - public class POST_issue : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; - - public POST_issue(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _outboxedSessionFactory = outboxedSessionFactory; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - // Building the Marten session - await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); - // Reading the request body via JSON deserialization - var (command, jsonContinue) = await ReadJsonAsync(httpContext); - if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; - var createEndpoint = new WolverineWebApi.CreateEndpoint(); - - // The actual HTTP request handler execution - (var issueCreated_response, var insertDoc) = createEndpoint.Create(command); - - if (insertDoc != null) - { - - // Placed by Wolverine's ISideEffect policy - insertDoc.Execute(documentSession); - - } - - // This response type customizes the HTTP response - ApplyHttpAware(issueCreated_response, httpContext); - - // Commit any outstanding Marten changes - await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); - - - // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 - await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); - - // Writing the response body to JSON because this was the first 'return variable' in the method signature - await WriteJsonAsync(httpContext, issueCreated_response); - } - - } - - // END: POST_issue - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_notbody.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_notbody.cs deleted file mode 100644 index 7c7631bc0..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_notbody.cs +++ /dev/null @@ -1,41 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using WolverineWebApi; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_notbody - public class POST_notbody : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly WolverineWebApi.Recorder _recorder; - - public POST_notbody(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, WolverineWebApi.Recorder recorder) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _recorder = recorder; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var attributeEndpoints = new WolverineWebApi.AttributeEndpoints(); - - // The actual HTTP request handler execution - var result_of_PostNotBody = attributeEndpoints.PostNotBody(_recorder); - - await WriteString(httpContext, result_of_PostNotBody); - } - - } - - // END: POST_notbody - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_create.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_create.cs deleted file mode 100644 index 5596555a8..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_create.cs +++ /dev/null @@ -1,58 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Marten.Publishing; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_orders_create - public class POST_orders_create : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; - - public POST_orders_create(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _outboxedSessionFactory = outboxedSessionFactory; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - // Building the Marten session - await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); - // Reading the request body via JSON deserialization - var (command, jsonContinue) = await ReadJsonAsync(httpContext); - if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; - - // The actual HTTP request handler execution - var orderStatus_response = WolverineWebApi.Marten.MarkItemEndpoint.StartOrder(command, documentSession); - - - // Commit any outstanding Marten changes - await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); - - - // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 - await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); - - // Writing the response body to JSON because this was the first 'return variable' in the method signature - await WriteJsonAsync(httpContext, orderStatus_response); - } - - } - - // END: POST_orders_create - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_create2.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_create2.cs deleted file mode 100644 index a210e4641..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_create2.cs +++ /dev/null @@ -1,79 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Marten.Publishing; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_orders_create2 - public class POST_orders_create2 : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; - - public POST_orders_create2(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _outboxedSessionFactory = outboxedSessionFactory; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - // Building the Marten session - await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); - // Catches any existing stream id collision exceptions - try - { - // Reading the request body via JSON deserialization - var (command, jsonContinue) = await ReadJsonAsync(httpContext); - if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; - - // The actual HTTP request handler execution - (var orderStatus_response, var startStream) = WolverineWebApi.Marten.MarkItemEndpoint.StartOrder2(command, documentSession); - - if (startStream != null) - { - - // Placed by Wolverine's ISideEffect policy - startStream.Execute(documentSession); - - } - - - // Commit any outstanding Marten changes - await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); - - - // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 - await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); - - // Writing the response body to JSON because this was the first 'return variable' in the method signature - await WriteJsonAsync(httpContext, orderStatus_response); - } - - - catch(Marten.Exceptions.ExistingStreamIdCollisionException e) - { - await WolverineWebApi.Marten.StreamCollisionExceptionPolicy.RespondWithProblemDetails(e, httpContext); - return; - } - - - } - - } - - // END: POST_orders_create2 - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_create3.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_create3.cs deleted file mode 100644 index 3876f3085..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_create3.cs +++ /dev/null @@ -1,81 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Marten.Publishing; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_orders_create3 - public class POST_orders_create3 : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; - - public POST_orders_create3(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _outboxedSessionFactory = outboxedSessionFactory; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - // Building the Marten session - await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); - // Catches any existing stream id collision exceptions - try - { - // Reading the request body via JSON deserialization - var (command, jsonContinue) = await ReadJsonAsync(httpContext); - if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; - - // The actual HTTP request handler execution - (var creationResponse_response, var startStream) = WolverineWebApi.Marten.MarkItemEndpoint.StartOrder3(command); - - if (startStream != null) - { - - // Placed by Wolverine's ISideEffect policy - startStream.Execute(documentSession); - - } - - // This response type customizes the HTTP response - ApplyHttpAware(creationResponse_response, httpContext); - - // Commit any outstanding Marten changes - await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); - - - // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 - await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); - - // Writing the response body to JSON because this was the first 'return variable' in the method signature - await WriteJsonAsync(httpContext, creationResponse_response); - } - - - catch(Marten.Exceptions.ExistingStreamIdCollisionException e) - { - await WolverineWebApi.Marten.StreamCollisionExceptionPolicy.RespondWithProblemDetails(e, httpContext); - return; - } - - - } - - } - - // END: POST_orders_create3 - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_create4.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_create4.cs deleted file mode 100644 index 0551a4131..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_create4.cs +++ /dev/null @@ -1,79 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Marten.Publishing; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_orders_create4 - public class POST_orders_create4 : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; - - public POST_orders_create4(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _outboxedSessionFactory = outboxedSessionFactory; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - // Building the Marten session - await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); - // Catches any existing stream id collision exceptions - try - { - // Reading the request body via JSON deserialization - var (command, jsonContinue) = await ReadJsonAsync(httpContext); - if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; - - // The actual HTTP request handler execution - (var orderStatus_response, var startStream) = WolverineWebApi.Marten.MarkItemEndpoint.StartOrder4(command); - - if (startStream != null) - { - - // Placed by Wolverine's ISideEffect policy - startStream.Execute(documentSession); - - } - - - // Commit any outstanding Marten changes - await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); - - - // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 - await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); - - // Writing the response body to JSON because this was the first 'return variable' in the method signature - await WriteJsonAsync(httpContext, orderStatus_response); - } - - - catch(Marten.Exceptions.ExistingStreamIdCollisionException e) - { - await WolverineWebApi.Marten.StreamCollisionExceptionPolicy.RespondWithProblemDetails(e, httpContext); - return; - } - - - } - - } - - // END: POST_orders_create4 - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_id_confirm.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_id_confirm.cs deleted file mode 100644 index a5b2e0e6d..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_id_confirm.cs +++ /dev/null @@ -1,72 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Marten.Publishing; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_orders_id_confirm - public class POST_orders_id_confirm : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; - - public POST_orders_id_confirm(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _outboxedSessionFactory = outboxedSessionFactory; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - // Reading the request body via JSON deserialization - var (command, jsonContinue) = await ReadJsonAsync(httpContext); - if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; - await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); - var eventStore = documentSession.Events; - - // Loading Marten aggregate - var eventStream = await eventStore.FetchForWriting(command.OrderId, httpContext.RequestAborted).ConfigureAwait(false); - - if (!System.Guid.TryParse((string)httpContext.GetRouteValue("id"), out var id)) - { - httpContext.Response.StatusCode = 404; - return; - } - - - - // The actual HTTP request handler execution - (var acceptResponse_response, var events) = WolverineWebApi.Marten.MarkItemEndpoint.Confirm(command, eventStream.Aggregate); - - if (events != null) - { - - // Capturing any possible events returned from the command handlers - eventStream.AppendMany(events); - - } - - // This response type customizes the HTTP response - ApplyHttpAware(acceptResponse_response, httpContext); - await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); - // Writing the response body to JSON because this was the first 'return variable' in the method signature - await WriteJsonAsync(httpContext, acceptResponse_response); - } - - } - - // END: POST_orders_id_confirm - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_itemready.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_itemready.cs deleted file mode 100644 index 0be4b1b43..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_itemready.cs +++ /dev/null @@ -1,67 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Marten.Publishing; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_orders_itemready - public class POST_orders_itemready : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; - - public POST_orders_itemready(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _outboxedSessionFactory = outboxedSessionFactory; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - // Reading the request body via JSON deserialization - var (command, jsonContinue) = await ReadJsonAsync(httpContext); - if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; - await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); - var eventStore = documentSession.Events; - - // Loading Marten aggregate - var eventStream = await eventStore.FetchForWriting(command.OrderId, command.Version, httpContext.RequestAborted).ConfigureAwait(false); - - System.Guid id = default; - System.Guid.TryParse(httpContext.Request.Query["id"], System.Globalization.CultureInfo.InvariantCulture, out id); - long expectedVersion = default; - long.TryParse(httpContext.Request.Query["expectedVersion"], System.Globalization.CultureInfo.InvariantCulture, out expectedVersion); - - // The actual HTTP request handler execution - (var orderStatus_response, var events) = WolverineWebApi.Marten.MarkItemEndpoint.Post(command, eventStream.Aggregate); - - if (events != null) - { - - // Capturing any possible events returned from the command handlers - eventStream.AppendMany(events); - - } - - await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); - // Writing the response body to JSON because this was the first 'return variable' in the method signature - await WriteJsonAsync(httpContext, orderStatus_response); - } - - } - - // END: POST_orders_itemready - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_orderId_ship2.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_orderId_ship2.cs deleted file mode 100644 index 213d2a172..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_orderId_ship2.cs +++ /dev/null @@ -1,66 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Marten.Publishing; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_orders_orderId_ship2 - public class POST_orders_orderId_ship2 : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; - - public POST_orders_orderId_ship2(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _outboxedSessionFactory = outboxedSessionFactory; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - if (!System.Guid.TryParse((string)httpContext.GetRouteValue("orderId"), out var orderId)) - { - httpContext.Response.StatusCode = 404; - return; - } - - - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - // Reading the request body via JSON deserialization - var (command, jsonContinue) = await ReadJsonAsync(httpContext); - if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; - await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); - var eventStore = documentSession.Events; - var eventStream = await documentSession.Events.FetchForWriting(orderId, httpContext.RequestAborted); - if (eventStream.Aggregate == null) - { - await Microsoft.AspNetCore.Http.Results.NotFound().ExecuteAsync(httpContext); - return; - } - - - // The actual HTTP request handler execution - var orderShipped = WolverineWebApi.Marten.MarkItemEndpoint.Ship(command, eventStream.Aggregate); - - eventStream.AppendOne(orderShipped); - await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); - // Wolverine automatically sets the status code to 204 for empty responses - if (!httpContext.Response.HasStarted) httpContext.Response.StatusCode = 204; - } - - } - - // END: POST_orders_orderId_ship2 - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_orderId_ship3.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_orderId_ship3.cs deleted file mode 100644 index cf1e3033a..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_orderId_ship3.cs +++ /dev/null @@ -1,63 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Marten.Publishing; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_orders_orderId_ship3 - public class POST_orders_orderId_ship3 : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; - - public POST_orders_orderId_ship3(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _outboxedSessionFactory = outboxedSessionFactory; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - if (!System.Guid.TryParse((string)httpContext.GetRouteValue("orderId"), out var orderId)) - { - httpContext.Response.StatusCode = 404; - return; - } - - - await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); - var eventStore = documentSession.Events; - var eventStream = await documentSession.Events.FetchForWriting(orderId, httpContext.RequestAborted); - if (eventStream.Aggregate == null) - { - await Microsoft.AspNetCore.Http.Results.NotFound().ExecuteAsync(httpContext); - return; - } - - - // The actual HTTP request handler execution - var orderShipped = WolverineWebApi.Marten.MarkItemEndpoint.Ship3(eventStream.Aggregate); - - eventStream.AppendOne(orderShipped); - await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); - // Wolverine automatically sets the status code to 204 for empty responses - if (!httpContext.Response.HasStarted) httpContext.Response.StatusCode = 204; - } - - } - - // END: POST_orders_orderId_ship3 - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_orderId_ship4.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_orderId_ship4.cs deleted file mode 100644 index b8916a390..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_orderId_ship4.cs +++ /dev/null @@ -1,63 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Marten.Publishing; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_orders_orderId_ship4 - public class POST_orders_orderId_ship4 : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; - - public POST_orders_orderId_ship4(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _outboxedSessionFactory = outboxedSessionFactory; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - if (!System.Guid.TryParse((string)httpContext.GetRouteValue("orderId"), out var orderId)) - { - httpContext.Response.StatusCode = 404; - return; - } - - - await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); - var eventStore = documentSession.Events; - var eventStream = await documentSession.Events.FetchForWriting(orderId, httpContext.RequestAborted); - if (eventStream.Aggregate == null) - { - await Microsoft.AspNetCore.Http.Results.NotFound().ExecuteAsync(httpContext); - return; - } - - - // The actual HTTP request handler execution - var orderShipped = WolverineWebApi.Marten.MarkItemEndpoint.Ship4(eventStream.Aggregate); - - eventStream.AppendOne(orderShipped); - await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); - // Wolverine automatically sets the status code to 204 for empty responses - if (!httpContext.Response.HasStarted) httpContext.Response.StatusCode = 204; - } - - } - - // END: POST_orders_orderId_ship4 - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_ship.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_ship.cs deleted file mode 100644 index b8b1b021f..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_orders_ship.cs +++ /dev/null @@ -1,67 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Marten.Publishing; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_orders_ship - public class POST_orders_ship : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; - - public POST_orders_ship(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _outboxedSessionFactory = outboxedSessionFactory; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - // Reading the request body via JSON deserialization - var (command, jsonContinue) = await ReadJsonAsync(httpContext); - if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; - await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); - var eventStore = documentSession.Events; - - // Loading Marten aggregate - var eventStream = await eventStore.FetchForWriting(command.OrderId, httpContext.RequestAborted).ConfigureAwait(false); - - var problemDetails1 = WolverineWebApi.Marten.CanShipOrderMiddleWare.Before(command, eventStream.Aggregate); - // Evaluate whether the processing should stop if there are any problems - if (!(ReferenceEquals(problemDetails1, Wolverine.Http.WolverineContinue.NoProblems))) - { - await WriteProblems(problemDetails1, httpContext).ConfigureAwait(false); - return; - } - - - System.Guid id = default; - System.Guid.TryParse(httpContext.Request.Query["id"], System.Globalization.CultureInfo.InvariantCulture, out id); - - // The actual HTTP request handler execution - var orderShipped = WolverineWebApi.Marten.MarkItemEndpoint.Ship(command, eventStream.Aggregate); - - eventStream.AppendOne(orderShipped); - await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); - // Wolverine automatically sets the status code to 204 for empty responses - if (!httpContext.Response.HasStarted) httpContext.Response.StatusCode = 204; - } - - } - - // END: POST_orders_ship - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_problems.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_problems.cs deleted file mode 100644 index b00ac6dcd..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_problems.cs +++ /dev/null @@ -1,50 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_problems - public class POST_problems : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public POST_problems(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var problemDetailsUsageEndpoint = new WolverineWebApi.ProblemDetailsUsageEndpoint(); - // Reading the request body via JSON deserialization - var (message, jsonContinue) = await ReadJsonAsync(httpContext); - if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; - var problemDetails1 = problemDetailsUsageEndpoint.Before(message); - // Evaluate whether the processing should stop if there are any problems - if (!(ReferenceEquals(problemDetails1, Wolverine.Http.WolverineContinue.NoProblems))) - { - await WriteProblems(problemDetails1, httpContext).ConfigureAwait(false); - return; - } - - - - // The actual HTTP request handler execution - var result_of_Post = WolverineWebApi.ProblemDetailsUsageEndpoint.Post(message); - - await WriteString(httpContext, result_of_Post); - } - - } - - // END: POST_problems - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_problems2.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_problems2.cs deleted file mode 100644 index e6e41de80..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_problems2.cs +++ /dev/null @@ -1,50 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_problems2 - public class POST_problems2 : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public POST_problems2(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - // Reading the request body via JSON deserialization - var (message, jsonContinue) = await ReadJsonAsync(httpContext); - if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; - var problemDetails1 = WolverineWebApi.NumberMessageHandler.Validate(message); - // Evaluate whether the processing should stop if there are any problems - if (!(ReferenceEquals(problemDetails1, Wolverine.Http.WolverineContinue.NoProblems))) - { - await WriteProblems(problemDetails1, httpContext).ConfigureAwait(false); - return; - } - - - - // The actual HTTP request handler execution - WolverineWebApi.NumberMessageHandler.Handle(message); - - // Wolverine automatically sets the status code to 204 for empty responses - if (!httpContext.Response.HasStarted) httpContext.Response.StatusCode = 204; - } - - } - - // END: POST_problems2 - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_publish_marten_message.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_publish_marten_message.cs deleted file mode 100644 index 6c49df880..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_publish_marten_message.cs +++ /dev/null @@ -1,60 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Marten.Publishing; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_publish_marten_message - public class POST_publish_marten_message : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; - - public POST_publish_marten_message(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _outboxedSessionFactory = outboxedSessionFactory; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - // Building the Marten session - await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); - Wolverine.Http.Runtime.RequestIdMiddleware.Apply(httpContext, messageContext); - // Reading the request body via JSON deserialization - var (data, jsonContinue) = await ReadJsonAsync(httpContext); - if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; - var serviceEndpoints = new WolverineWebApi.ServiceEndpoints(); - - // The actual HTTP request handler execution - await serviceEndpoints.PublishData(data, messageContext, documentSession).ConfigureAwait(false); - - - // Commit any outstanding Marten changes - await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); - - - // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 - await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); - - // Wolverine automatically sets the status code to 204 for empty responses - if (!httpContext.Response.HasStarted) httpContext.Response.StatusCode = 204; - } - - } - - // END: POST_publish_marten_message - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_publish_message1.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_publish_message1.cs deleted file mode 100644 index 28d5b11fe..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_publish_message1.cs +++ /dev/null @@ -1,46 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_publish_message1 - public class POST_publish_message1 : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - - public POST_publish_message1(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - Wolverine.Http.Runtime.RequestIdMiddleware.Apply(httpContext, messageContext); - // Reading the request body via JSON deserialization - var (message, jsonContinue) = await ReadJsonAsync(httpContext); - if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; - var publishingEndpoint = new Wolverine.Http.Runtime.PublishingEndpoint(); - - // The actual HTTP request handler execution - var result_of_PublishAsync = await publishingEndpoint.PublishAsync(message, messageContext, httpContext.Response); - - await WriteString(httpContext, result_of_PublishAsync); - } - - } - - // END: POST_publish_message1 - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_question.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_question.cs deleted file mode 100644 index 0acd72261..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_question.cs +++ /dev/null @@ -1,42 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_question - public class POST_question : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public POST_question(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - // Reading the request body via JSON deserialization - var (question, jsonContinue) = await ReadJsonAsync(httpContext); - if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; - // Just saying hello in the code! Also testing the usage of attributes to customize endpoints - - // The actual HTTP request handler execution - var arithmeticResults_response = WolverineWebApi.TestEndpoints.PostJson(question); - - // Writing the response body to JSON because this was the first 'return variable' in the method signature - await WriteJsonAsync(httpContext, arithmeticResults_response); - } - - } - - // END: POST_question - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_reservation.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_reservation.cs deleted file mode 100644 index 22ff1cbbd..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_reservation.cs +++ /dev/null @@ -1,65 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Marten.Publishing; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_reservation - public class POST_reservation : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; - - public POST_reservation(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _outboxedSessionFactory = outboxedSessionFactory; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - // Building the Marten session - await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); - // Reading the request body via JSON deserialization - var (start, jsonContinue) = await ReadJsonAsync(httpContext); - if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; - - // The actual HTTP request handler execution - (var reservationBooked_response, var reservation, var reservationTimeout) = WolverineWebApi.ReservationEndpoint.Post(start); - - - // Register the document operation with the current session - documentSession.Insert(reservation); - - // Outgoing, cascaded message - await messageContext.EnqueueCascadingAsync(reservationTimeout).ConfigureAwait(false); - - - // Commit any outstanding Marten changes - await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); - - - // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 - await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); - - // Writing the response body to JSON because this was the first 'return variable' in the method signature - await WriteJsonAsync(httpContext, reservationBooked_response); - } - - } - - // END: POST_reservation - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_send_always_dead_letter.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_send_always_dead_letter.cs deleted file mode 100644 index 1ec96452f..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_send_always_dead_letter.cs +++ /dev/null @@ -1,46 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_send_always_dead_letter - public class POST_send_always_dead_letter : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - - public POST_send_always_dead_letter(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - Wolverine.Http.Runtime.RequestIdMiddleware.Apply(httpContext, messageContext); - // Reading the request body via JSON deserialization - var (message, jsonContinue) = await ReadJsonAsync(httpContext); - if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; - var sendingEndpoint = new Wolverine.Http.Runtime.SendingEndpoint(); - - // The actual HTTP request handler execution - var result_of_SendAsync = await sendingEndpoint.SendAsync(message, messageContext, httpContext.Response); - - await WriteString(httpContext, result_of_SendAsync); - } - - } - - // END: POST_send_always_dead_letter - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_send_message5.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_send_message5.cs deleted file mode 100644 index 92f1bc4ad..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_send_message5.cs +++ /dev/null @@ -1,46 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_send_message5 - public class POST_send_message5 : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - - public POST_send_message5(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - Wolverine.Http.Runtime.RequestIdMiddleware.Apply(httpContext, messageContext); - // Reading the request body via JSON deserialization - var (message, jsonContinue) = await ReadJsonAsync(httpContext); - if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; - var sendingEndpoint = new Wolverine.Http.Runtime.SendingEndpoint(); - - // The actual HTTP request handler execution - var result_of_SendAsync = await sendingEndpoint.SendAsync(message, messageContext, httpContext.Response); - - await WriteString(httpContext, result_of_SendAsync); - } - - } - - // END: POST_send_message5 - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_some_id.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_some_id.cs deleted file mode 100644 index 26b04399e..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_some_id.cs +++ /dev/null @@ -1,75 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Marten.Publishing; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_some_id - public class POST_some_id : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; - - public POST_some_id(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _outboxedSessionFactory = outboxedSessionFactory; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - // Building the Marten session - await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); - // Reading the request body via JSON deserialization - var (request, jsonContinue) = await ReadJsonAsync(httpContext); - if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; - var id = (string)httpContext.GetRouteValue("id"); - var someDocument = await WolverineWebApi.Bugs.SomeEndpoint.LoadAsync(id, documentSession).ConfigureAwait(false); - // 404 if this required object is null - if (someDocument == null) - { - httpContext.Response.StatusCode = 404; - return; - } - - - // The actual HTTP request handler execution - var storeDoc = WolverineWebApi.Bugs.SomeEndpoint.Handle(request, someDocument); - - if (storeDoc != null) - { - - // Placed by Wolverine's ISideEffect policy - storeDoc.Execute(documentSession); - - } - - - // Commit any outstanding Marten changes - await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); - - - // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 - await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); - - // Wolverine automatically sets the status code to 204 for empty responses - if (!httpContext.Response.HasStarted) httpContext.Response.StatusCode = 204; - } - - } - - // END: POST_some_id - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_spawn.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_spawn.cs deleted file mode 100644 index 92093e052..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_spawn.cs +++ /dev/null @@ -1,52 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_spawn - public class POST_spawn : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - - public POST_spawn(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - // Reading the request body via JSON deserialization - var (input, jsonContinue) = await ReadJsonAsync(httpContext); - if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; - - // The actual HTTP request handler execution - (var stringValue, var outgoingMessages) = WolverineWebApi.MessageSpawnerEndpoint.Post(input); - - - // Outgoing, cascaded message - await messageContext.EnqueueCascadingAsync(outgoingMessages).ConfigureAwait(false); - - await WriteString(httpContext, stringValue); - - // Making sure there is at least one call to flush outgoing, cascading messages - await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); - - } - - } - - // END: POST_spawn - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_spawn2.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_spawn2.cs deleted file mode 100644 index 8facd7245..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_spawn2.cs +++ /dev/null @@ -1,54 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_spawn2 - public class POST_spawn2 : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - - public POST_spawn2(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - - // The actual HTTP request handler execution - (var httpMessage1, var httpMessage2) = WolverineWebApi.MessageSpawnerEndpoint.Post(); - - - // Outgoing, cascaded message - await messageContext.EnqueueCascadingAsync(httpMessage1).ConfigureAwait(false); - - - // Outgoing, cascaded message - await messageContext.EnqueueCascadingAsync(httpMessage2).ConfigureAwait(false); - - // Wolverine automatically sets the status code to 204 for empty responses - if (!httpContext.Response.HasStarted) httpContext.Response.StatusCode = 204; - - // Making sure there is at least one call to flush outgoing, cascading messages - await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); - - } - - } - - // END: POST_spawn2 - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_status.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_status.cs deleted file mode 100644 index b7836dbcc..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_status.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using Microsoft.Extensions.Logging; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_status - public class POST_status : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Microsoft.Extensions.Logging.ILogger _loggerForMessage; - - public POST_status(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Microsoft.Extensions.Logging.ILogger loggerForMessage) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _loggerForMessage = loggerForMessage; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - // Reading the request body via JSON deserialization - var (request, jsonContinue) = await ReadJsonAsync(httpContext); - if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; - - // The actual HTTP request handler execution - var result_of_PostStatusCode = WolverineWebApi.StatusCodeEndpoint.PostStatusCode(request, ((Microsoft.Extensions.Logging.ILogger)_loggerForMessage)); - - httpContext.Response.StatusCode = result_of_PostStatusCode; - } - - } - - // END: POST_status - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_users_sign_up.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_users_sign_up.cs deleted file mode 100644 index 04d4a7814..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_users_sign_up.cs +++ /dev/null @@ -1,40 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_users_sign_up - public class POST_users_sign_up : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - - public POST_users_sign_up(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - // Reading the request body via JSON deserialization - var (request, jsonContinue) = await ReadJsonAsync(httpContext); - if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; - - // The actual HTTP request handler execution - var result = WolverineWebApi.SignupEndpoint.SignUp(request); - - await result.ExecuteAsync(httpContext).ConfigureAwait(false); - } - - } - - // END: POST_users_sign_up - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_validate2_customer.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_validate2_customer.cs deleted file mode 100644 index bbc6479b0..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_validate2_customer.cs +++ /dev/null @@ -1,58 +0,0 @@ -// -#pragma warning disable -using FluentValidation; -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Http.FluentValidation; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_validate2_customer - public class POST_validate2_customer : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Http.FluentValidation.IProblemDetailSource _problemDetailSource; - private readonly FluentValidation.IValidator _validator; - - public POST_validate2_customer(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Http.FluentValidation.IProblemDetailSource problemDetailSource, FluentValidation.IValidator validator) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _problemDetailSource = problemDetailSource; - _validator = validator; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - // Reading the request body via JSON deserialization - var (customer, jsonContinue) = await ReadJsonAsync(httpContext); - if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; - - // Execute FluentValidation validators - var result1 = await Wolverine.Http.FluentValidation.Internals.FluentValidationHttpExecutor.ExecuteOne(_validator, _problemDetailSource, customer).ConfigureAwait(false); - - // Evaluate whether or not the execution should be stopped based on the IResult value - if (!(result1 is Wolverine.Http.WolverineContinue)) - { - await result1.ExecuteAsync(httpContext).ConfigureAwait(false); - return; - } - - - - // The actual HTTP request handler execution - var result_of_Post = Wolverine.Http.Tests.DifferentAssembly.Validation.Validated2Endpoint.Post(customer); - - await WriteString(httpContext, result_of_Post); - } - - } - - // END: POST_validate2_customer - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_validate_customer.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_validate_customer.cs deleted file mode 100644 index 8b611eb38..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_validate_customer.cs +++ /dev/null @@ -1,58 +0,0 @@ -// -#pragma warning disable -using FluentValidation; -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Http.FluentValidation; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_validate_customer - public class POST_validate_customer : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly FluentValidation.IValidator _validator; - private readonly Wolverine.Http.FluentValidation.IProblemDetailSource _problemDetailSource; - - public POST_validate_customer(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, FluentValidation.IValidator validator, Wolverine.Http.FluentValidation.IProblemDetailSource problemDetailSource) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _validator = validator; - _problemDetailSource = problemDetailSource; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - // Reading the request body via JSON deserialization - var (customer, jsonContinue) = await ReadJsonAsync(httpContext); - if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; - - // Execute FluentValidation validators - var result1 = await Wolverine.Http.FluentValidation.Internals.FluentValidationHttpExecutor.ExecuteOne(_validator, _problemDetailSource, customer).ConfigureAwait(false); - - // Evaluate whether or not the execution should be stopped based on the IResult value - if (!(result1 is Wolverine.Http.WolverineContinue)) - { - await result1.ExecuteAsync(httpContext).ConfigureAwait(false); - return; - } - - - - // The actual HTTP request handler execution - var result_of_Post = WolverineWebApi.Validation.ValidatedEndpoint.Post(customer); - - await WriteString(httpContext, result_of_Post); - } - - } - - // END: POST_validate_customer - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_validate_user.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_validate_user.cs deleted file mode 100644 index c69e29d8a..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_validate_user.cs +++ /dev/null @@ -1,55 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Collections.Generic; -using System.Linq; -using Wolverine.Http; -using Wolverine.Http.FluentValidation; - -namespace Internal.Generated.WolverineHandlers -{ - // START: POST_validate_user - public class POST_validate_user : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly System.Collections.Generic.IEnumerable> _validatorIEnumerable; - private readonly Wolverine.Http.FluentValidation.IProblemDetailSource _problemDetailSource; - - public POST_validate_user(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, System.Collections.Generic.IEnumerable> validatorIEnumerable, Wolverine.Http.FluentValidation.IProblemDetailSource problemDetailSource) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _validatorIEnumerable = validatorIEnumerable; - _problemDetailSource = problemDetailSource; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - // Reading the request body via JSON deserialization - var (user, jsonContinue) = await ReadJsonAsync(httpContext); - if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; - var result1 = await Wolverine.Http.FluentValidation.Internals.FluentValidationHttpExecutor.ExecuteMany(_validatorIEnumerable, _problemDetailSource, user).ConfigureAwait(false); - // Evaluate whether or not the execution should be stopped based on the IResult value - if (!(result1 is Wolverine.Http.WolverineContinue)) - { - await result1.ExecuteAsync(httpContext).ConfigureAwait(false); - return; - } - - - - // The actual HTTP request handler execution - var result_of_Post = WolverineWebApi.Validation.ValidatedEndpoint.Post(user); - - await WriteString(httpContext, result_of_Post); - } - - } - - // END: POST_validate_user - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/PUT_todos2_id.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/PUT_todos2_id.cs deleted file mode 100644 index e661a2c52..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/PUT_todos2_id.cs +++ /dev/null @@ -1,74 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Marten.Publishing; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: PUT_todos2_id - public class PUT_todos2_id : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; - - public PUT_todos2_id(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _outboxedSessionFactory = outboxedSessionFactory; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - // Building the Marten session - await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); - if (!int.TryParse((string)httpContext.GetRouteValue("id"), out var id)) - { - httpContext.Response.StatusCode = 404; - return; - } - - - // Reading the request body via JSON deserialization - var (request, jsonContinue) = await ReadJsonAsync(httpContext); - if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; - (var todo, var result1) = await WolverineWebApi.Samples.Update2Endpoint.LoadAsync(id, request, documentSession).ConfigureAwait(false); - // Evaluate whether or not the execution should be stopped based on the IResult value - if (!(result1 is Wolverine.Http.WolverineContinue)) - { - await result1.ExecuteAsync(httpContext).ConfigureAwait(false); - return; - } - - - - // The actual HTTP request handler execution - var todo_response = WolverineWebApi.Samples.Update2Endpoint.Put(id, request, todo, documentSession); - - - // Commit any outstanding Marten changes - await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); - - - // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 - await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); - - // Writing the response body to JSON because this was the first 'return variable' in the method signature - await WriteJsonAsync(httpContext, todo_response); - } - - } - - // END: PUT_todos2_id - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/PUT_todos_id.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/PUT_todos_id.cs deleted file mode 100644 index 4e8aee3ed..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/PUT_todos_id.cs +++ /dev/null @@ -1,81 +0,0 @@ -// -#pragma warning disable -using Microsoft.AspNetCore.Routing; -using System; -using System.Linq; -using Wolverine.Http; -using Wolverine.Marten.Publishing; -using Wolverine.Runtime; - -namespace Internal.Generated.WolverineHandlers -{ - // START: PUT_todos_id - public class PUT_todos_id : Wolverine.Http.HttpHandler - { - private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; - private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; - private readonly Wolverine.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory; - - public PUT_todos_id(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions, Wolverine.Runtime.IWolverineRuntime wolverineRuntime, Wolverine.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory) : base(wolverineHttpOptions) - { - _wolverineHttpOptions = wolverineHttpOptions; - _wolverineRuntime = wolverineRuntime; - _outboxedSessionFactory = outboxedSessionFactory; - } - - - - public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) - { - var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); - // Building the Marten session - await using var documentSession = _outboxedSessionFactory.OpenSession(messageContext); - if (!int.TryParse((string)httpContext.GetRouteValue("id"), out var id)) - { - httpContext.Response.StatusCode = 404; - return; - } - - - // Reading the request body via JSON deserialization - var (request, jsonContinue) = await ReadJsonAsync(httpContext); - if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; - var todo = await WolverineWebApi.Samples.UpdateEndpoint.LoadAsync(id, documentSession).ConfigureAwait(false); - // 404 if this required object is null - if (todo == null) - { - httpContext.Response.StatusCode = 404; - return; - } - - - // The actual HTTP request handler execution - var storeDoc = WolverineWebApi.Samples.UpdateEndpoint.Put(id, request, todo); - - if (storeDoc != null) - { - - // Placed by Wolverine's ISideEffect policy - storeDoc.Execute(documentSession); - - } - - - // Commit any outstanding Marten changes - await documentSession.SaveChangesAsync(httpContext.RequestAborted).ConfigureAwait(false); - - - // Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536 - await messageContext.FlushOutgoingMessagesAsync().ConfigureAwait(false); - - // Wolverine automatically sets the status code to 204 for empty responses - if (!httpContext.Response.HasStarted) httpContext.Response.StatusCode = 204; - } - - } - - // END: PUT_todos_id - - -} - diff --git a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/TelegramUpdatedHandler96651444.cs b/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/TelegramUpdatedHandler96651444.cs deleted file mode 100644 index 155923aa9..000000000 --- a/src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/TelegramUpdatedHandler96651444.cs +++ /dev/null @@ -1,29 +0,0 @@ -// -#pragma warning disable - -namespace Internal.Generated.WolverineHandlers -{ - // START: TelegramUpdatedHandler96651444 - public class TelegramUpdatedHandler96651444 : Wolverine.Runtime.Handlers.MessageHandler - { - - - public override System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) - { - // The actual message body - var telegramUpdated = (WolverineWebApi.Bugs.TelegramUpdated)context.Envelope.Message; - - - // The actual message execution - WolverineWebApi.Bugs.TelegramUpdatedHandler.Handle(telegramUpdated); - - return System.Threading.Tasks.Task.CompletedTask; - } - - } - - // END: TelegramUpdatedHandler96651444 - - -} - diff --git a/src/Http/WolverineWebApi/Program.cs b/src/Http/WolverineWebApi/Program.cs index 3d4c2136a..bd9071919 100644 --- a/src/Http/WolverineWebApi/Program.cs +++ b/src/Http/WolverineWebApi/Program.cs @@ -62,6 +62,7 @@ { opts.Connection(Servers.PostgresConnectionString); opts.DatabaseSchemaName = "http"; + opts.DisableNpgsqlLogging = true; }).IntegrateWithWolverine(); diff --git a/src/Persistence/Wolverine.EntityFrameworkCore/Codegen/EFCorePersistenceFrameProvider.cs b/src/Persistence/Wolverine.EntityFrameworkCore/Codegen/EFCorePersistenceFrameProvider.cs index 78fdb78b4..55bed6c7f 100644 --- a/src/Persistence/Wolverine.EntityFrameworkCore/Codegen/EFCorePersistenceFrameProvider.cs +++ b/src/Persistence/Wolverine.EntityFrameworkCore/Codegen/EFCorePersistenceFrameProvider.cs @@ -104,7 +104,7 @@ public void ApplyTransactionSupport(IChain chain, IServiceContainer container) if (chain.RequiresOutbox() && chain.ShouldFlushOutgoingMessages()) { #pragma warning disable CS4014 - chain.Postprocessors.Add(MethodCall.For(x => x.FlushOutgoingMessagesAsync())); + chain.Postprocessors.Add(new FlushOutgoingMessages()); #pragma warning restore CS4014 } } diff --git a/src/Persistence/Wolverine.Marten/Persistence/Sagas/MartenPersistenceFrameProvider.cs b/src/Persistence/Wolverine.Marten/Persistence/Sagas/MartenPersistenceFrameProvider.cs index 085deeea8..f9fb65a27 100644 --- a/src/Persistence/Wolverine.Marten/Persistence/Sagas/MartenPersistenceFrameProvider.cs +++ b/src/Persistence/Wolverine.Marten/Persistence/Sagas/MartenPersistenceFrameProvider.cs @@ -38,10 +38,7 @@ public void ApplyTransactionSupport(IChain chain, IServiceContainer container) saveChanges.CommentText = "Commit any outstanding Marten changes"; chain.Postprocessors.Add(saveChanges); - var methodCall = MethodCall.For(x => x.FlushOutgoingMessagesAsync()); - methodCall.CommentText = "Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536"; - - chain.Postprocessors.Add(methodCall); + chain.Postprocessors.Add(new FlushOutgoingMessages()); } } } diff --git a/src/Persistence/Wolverine.RavenDb/Internals/RavenDbPersistenceFrameProvider.cs b/src/Persistence/Wolverine.RavenDb/Internals/RavenDbPersistenceFrameProvider.cs index 1e1e5bb52..ed39035cd 100644 --- a/src/Persistence/Wolverine.RavenDb/Internals/RavenDbPersistenceFrameProvider.cs +++ b/src/Persistence/Wolverine.RavenDb/Internals/RavenDbPersistenceFrameProvider.cs @@ -24,11 +24,8 @@ public void ApplyTransactionSupport(IChain chain, IServiceContainer container) var saveChanges = MethodCall.For(x => x.SaveChangesAsync(default)); saveChanges.CommentText = "Commit any outstanding RavenDb changes"; chain.Postprocessors.Add(saveChanges); - - var methodCall = MethodCall.For(x => x.FlushOutgoingMessagesAsync()); - methodCall.CommentText = "Have to flush outgoing messages just in case RavenDb did nothing because of https://github.com/JasperFx/wolverine/issues/536"; - - chain.Postprocessors.Add(methodCall); + + chain.Postprocessors.Add(new FlushOutgoingMessages()); } } } diff --git a/src/Wolverine/Configuration/Chain.cs b/src/Wolverine/Configuration/Chain.cs index 3620afccc..8cd8c90bf 100644 --- a/src/Wolverine/Configuration/Chain.cs +++ b/src/Wolverine/Configuration/Chain.cs @@ -256,12 +256,15 @@ protected void applyImpliedMiddlewareFromHandlers(GenerationRules generationRule } var afters = MiddlewarePolicy.FilterMethods(handlerType.GetMethods(), - MiddlewarePolicy.AfterMethodNames); + MiddlewarePolicy.AfterMethodNames).ToArray(); - foreach (var after in afters) + if (afters.Any()) { - var frame = new MethodCall(handlerType, after); - Postprocessors.Add(frame); + for (int i = 0; i < afters.Length; i++) + { + var frame = new MethodCall(handlerType, afters[i]); + Postprocessors.Insert(i, frame); + } } } } diff --git a/src/Wolverine/Middleware/MiddlewarePolicy.cs b/src/Wolverine/Middleware/MiddlewarePolicy.cs index c244a1f27..760730f11 100644 --- a/src/Wolverine/Middleware/MiddlewarePolicy.cs +++ b/src/Wolverine/Middleware/MiddlewarePolicy.cs @@ -58,9 +58,17 @@ internal static void ApplyToChain(List applications, GenerationRule chain.Middleware.Insert(i, befores[i]); } - var afters = applications.ToArray().Reverse().SelectMany(x => x.BuildAfterCalls(chain, rules)); - - chain.Postprocessors.AddRange(afters); + var afters = applications.ToArray().Reverse().SelectMany(x => x.BuildAfterCalls(chain, rules)).ToArray(); + + if (afters.Any()) + { + for (int i = 0; i < afters.Length; i++) + { + chain.Postprocessors.Insert(i, afters[i]); + } + + //chain.Postprocessors.AddRange(afters); + } } public Application AddType(Type middlewareType, Func? filter = null) diff --git a/src/Wolverine/Persistence/FlushOutgoingMessages.cs b/src/Wolverine/Persistence/FlushOutgoingMessages.cs new file mode 100644 index 000000000..e5eec26b1 --- /dev/null +++ b/src/Wolverine/Persistence/FlushOutgoingMessages.cs @@ -0,0 +1,12 @@ +using JasperFx.CodeGeneration.Frames; +using Wolverine.Runtime; + +namespace Wolverine.Persistence; + +public class FlushOutgoingMessages : MethodCall +{ + public FlushOutgoingMessages() : base(typeof(MessageContext), nameof(MessageContext.FlushOutgoingMessagesAsync)) + { + CommentText = "Have to flush outgoing messages just in case Marten did nothing because of https://github.com/JasperFx/wolverine/issues/536"; + } +} \ No newline at end of file diff --git a/src/Wolverine/Runtime/Handlers/VariableExtensions.cs b/src/Wolverine/Runtime/Handlers/CodeGenExtensions.cs similarity index 89% rename from src/Wolverine/Runtime/Handlers/VariableExtensions.cs rename to src/Wolverine/Runtime/Handlers/CodeGenExtensions.cs index f1adc10e4..24b50a2e5 100644 --- a/src/Wolverine/Runtime/Handlers/VariableExtensions.cs +++ b/src/Wolverine/Runtime/Handlers/CodeGenExtensions.cs @@ -6,7 +6,7 @@ namespace Wolverine.Runtime.Handlers; -public static class VariableExtensions +public static class CodeGenExtensions { internal static readonly string ReturnActionKey = "ReturnAction"; @@ -14,6 +14,29 @@ public static bool HasReturnAction(this Variable variable) { return variable.Properties.ContainsKey(ReturnActionKey); } + + /// + /// Does this frame possibly send any kind of cascading messages? + /// + /// + /// + public static bool MaySendMessages(this Frame frame) + { + if (frame is CaptureCascadingMessages) return true; + if (frame is MethodCall call) + { + if (call.Method.GetParameters().Any(x => + x.ParameterType == typeof(IMessageBus) || x.ParameterType == typeof(MessageContext) || + x.ParameterType == typeof(IMessageContext))) + { + return true; + } + + if (call.CreatesNewOf()) return true; + } + + return false; + } /// /// Override how Wolverine will generate code to handle this value returned from a handler call diff --git a/src/Wolverine/Runtime/Handlers/HandlerChain.cs b/src/Wolverine/Runtime/Handlers/HandlerChain.cs index 9236cb267..b32353a31 100644 --- a/src/Wolverine/Runtime/Handlers/HandlerChain.cs +++ b/src/Wolverine/Runtime/Handlers/HandlerChain.cs @@ -12,6 +12,7 @@ using Wolverine.Configuration; using Wolverine.ErrorHandling; using Wolverine.Logging; +using Wolverine.Persistence; using Wolverine.Runtime.Routing; using Wolverine.Transports.Local; using Wolverine.Transports.Stub; @@ -404,8 +405,6 @@ internal virtual List DetermineFrames(GenerationRules rules, IServiceCont { methodCall.TryReplaceVariableCreationWithAssignment(messageVariable); } - - // The Enqueue cascading needs to happen before the post processors because of the // transactional & outbox support