diff --git a/src/Http/DeepMiddlewareUsage/DeepMiddlewareUsage.csproj b/src/Http/DeepMiddlewareUsage/DeepMiddlewareUsage.csproj
new file mode 100644
index 000000000..5773bd851
--- /dev/null
+++ b/src/Http/DeepMiddlewareUsage/DeepMiddlewareUsage.csproj
@@ -0,0 +1,19 @@
+
+
+
+ net9.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+ Servers.cs
+
+
+
+
diff --git a/src/Http/DeepMiddlewareUsage/DeepMiddlewareUsage.http b/src/Http/DeepMiddlewareUsage/DeepMiddlewareUsage.http
new file mode 100644
index 000000000..b442d7cbf
--- /dev/null
+++ b/src/Http/DeepMiddlewareUsage/DeepMiddlewareUsage.http
@@ -0,0 +1,6 @@
+@DeepMiddlewareUsage_HostAddress = http://localhost:5063
+
+GET {{DeepMiddlewareUsage_HostAddress}}/weatherforecast/
+Accept: application/json
+
+###
diff --git a/src/Http/DeepMiddlewareUsage/Internal/Generated/DocumentStorage/DeadLetterEventProvider1642069326.cs b/src/Http/DeepMiddlewareUsage/Internal/Generated/DocumentStorage/DeadLetterEventProvider1642069326.cs
new file mode 100644
index 000000000..8687d107c
--- /dev/null
+++ b/src/Http/DeepMiddlewareUsage/Internal/Generated/DocumentStorage/DeadLetterEventProvider1642069326.cs
@@ -0,0 +1,831 @@
+//
+#pragma warning disable
+using JasperFx.Events.Daemon;
+using Marten.Internal;
+using Marten.Internal.Storage;
+using Marten.Schema;
+using Marten.Schema.Arguments;
+using Npgsql;
+using System;
+using System.Collections.Generic;
+using Weasel.Core;
+using Weasel.Postgresql;
+
+namespace Marten.Generated.DocumentStorage
+{
+ // START: UpsertDeadLetterEventOperation1642069326
+ [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")]
+ public sealed class UpsertDeadLetterEventOperation1642069326 : Marten.Internal.Operations.StorageOperation
+ {
+ private readonly JasperFx.Events.Daemon.DeadLetterEvent _document;
+ private readonly System.Guid _id;
+ private readonly System.Collections.Generic.Dictionary _versions;
+ private readonly Marten.Schema.DocumentMapping _mapping;
+
+ public UpsertDeadLetterEventOperation1642069326(JasperFx.Events.Daemon.DeadLetterEvent document, System.Guid id, System.Collections.Generic.Dictionary versions, Marten.Schema.DocumentMapping mapping) : base(document, id, versions, mapping)
+ {
+ _document = document;
+ _id = id;
+ _versions = versions;
+ _mapping = mapping;
+ }
+
+
+
+ public override void Postprocess(System.Data.Common.DbDataReader reader, System.Collections.Generic.IList exceptions)
+ {
+ storeVersion();
+ }
+
+
+ public override System.Threading.Tasks.Task PostprocessAsync(System.Data.Common.DbDataReader reader, System.Collections.Generic.IList exceptions, System.Threading.CancellationToken token)
+ {
+ storeVersion();
+ // Nothing
+ return System.Threading.Tasks.Task.CompletedTask;
+ }
+
+
+ public override Marten.Internal.Operations.OperationRole Role()
+ {
+ return Marten.Internal.Operations.OperationRole.Upsert;
+ }
+
+
+ public override NpgsqlTypes.NpgsqlDbType DbType()
+ {
+ return NpgsqlTypes.NpgsqlDbType.Uuid;
+ }
+
+
+ public override void ConfigureParameters(Weasel.Postgresql.IGroupedParameterBuilder parameterBuilder, Weasel.Postgresql.ICommandBuilder builder, JasperFx.Events.Daemon.DeadLetterEvent document, Marten.Internal.IMartenSession session)
+ {
+ builder.Append("select trainers.mt_upsert_deadletterevent(");
+ var parameter0 = parameterBuilder.AppendParameter(session.Serializer.ToJson(_document));
+ parameter0.NpgsqlDbType = NpgsqlTypes.NpgsqlDbType.Jsonb;
+ // .Net Class Type
+ var parameter1 = parameterBuilder.AppendParameter(_document.GetType().FullName);
+ parameter1.NpgsqlDbType = NpgsqlTypes.NpgsqlDbType.Varchar;
+ var parameter2 = parameterBuilder.AppendParameter((document is JasperFx.Events.Daemon.DeadLetterEvent ? ((JasperFx.Events.Daemon.DeadLetterEvent)document).Id : default(System.Guid)));
+ setVersionParameter(parameterBuilder);
+ builder.Append(')');
+ }
+
+ }
+
+ // END: UpsertDeadLetterEventOperation1642069326
+
+
+ // START: InsertDeadLetterEventOperation1642069326
+ [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")]
+ public sealed class InsertDeadLetterEventOperation1642069326 : Marten.Internal.Operations.StorageOperation
+ {
+ private readonly JasperFx.Events.Daemon.DeadLetterEvent _document;
+ private readonly System.Guid _id;
+ private readonly System.Collections.Generic.Dictionary _versions;
+ private readonly Marten.Schema.DocumentMapping _mapping;
+
+ public InsertDeadLetterEventOperation1642069326(JasperFx.Events.Daemon.DeadLetterEvent document, System.Guid id, System.Collections.Generic.Dictionary versions, Marten.Schema.DocumentMapping mapping) : base(document, id, versions, mapping)
+ {
+ _document = document;
+ _id = id;
+ _versions = versions;
+ _mapping = mapping;
+ }
+
+
+
+ public override void Postprocess(System.Data.Common.DbDataReader reader, System.Collections.Generic.IList exceptions)
+ {
+ storeVersion();
+ }
+
+
+ public override System.Threading.Tasks.Task PostprocessAsync(System.Data.Common.DbDataReader reader, System.Collections.Generic.IList exceptions, System.Threading.CancellationToken token)
+ {
+ storeVersion();
+ // Nothing
+ return System.Threading.Tasks.Task.CompletedTask;
+ }
+
+
+ public override Marten.Internal.Operations.OperationRole Role()
+ {
+ return Marten.Internal.Operations.OperationRole.Insert;
+ }
+
+
+ public override NpgsqlTypes.NpgsqlDbType DbType()
+ {
+ return NpgsqlTypes.NpgsqlDbType.Uuid;
+ }
+
+
+ public override void ConfigureParameters(Weasel.Postgresql.IGroupedParameterBuilder parameterBuilder, Weasel.Postgresql.ICommandBuilder builder, JasperFx.Events.Daemon.DeadLetterEvent document, Marten.Internal.IMartenSession session)
+ {
+ builder.Append("select trainers.mt_insert_deadletterevent(");
+ var parameter0 = parameterBuilder.AppendParameter(session.Serializer.ToJson(_document));
+ parameter0.NpgsqlDbType = NpgsqlTypes.NpgsqlDbType.Jsonb;
+ // .Net Class Type
+ var parameter1 = parameterBuilder.AppendParameter(_document.GetType().FullName);
+ parameter1.NpgsqlDbType = NpgsqlTypes.NpgsqlDbType.Varchar;
+ var parameter2 = parameterBuilder.AppendParameter((document is JasperFx.Events.Daemon.DeadLetterEvent ? ((JasperFx.Events.Daemon.DeadLetterEvent)document).Id : default(System.Guid)));
+ setVersionParameter(parameterBuilder);
+ builder.Append(')');
+ }
+
+ }
+
+ // END: InsertDeadLetterEventOperation1642069326
+
+
+ // START: UpdateDeadLetterEventOperation1642069326
+ [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")]
+ public sealed class UpdateDeadLetterEventOperation1642069326 : Marten.Internal.Operations.StorageOperation
+ {
+ private readonly JasperFx.Events.Daemon.DeadLetterEvent _document;
+ private readonly System.Guid _id;
+ private readonly System.Collections.Generic.Dictionary _versions;
+ private readonly Marten.Schema.DocumentMapping _mapping;
+
+ public UpdateDeadLetterEventOperation1642069326(JasperFx.Events.Daemon.DeadLetterEvent document, System.Guid id, System.Collections.Generic.Dictionary versions, Marten.Schema.DocumentMapping mapping) : base(document, id, versions, mapping)
+ {
+ _document = document;
+ _id = id;
+ _versions = versions;
+ _mapping = mapping;
+ }
+
+
+
+ public override void Postprocess(System.Data.Common.DbDataReader reader, System.Collections.Generic.IList exceptions)
+ {
+ storeVersion();
+ postprocessUpdate(reader, exceptions);
+ }
+
+
+ public override async System.Threading.Tasks.Task PostprocessAsync(System.Data.Common.DbDataReader reader, System.Collections.Generic.IList exceptions, System.Threading.CancellationToken token)
+ {
+ storeVersion();
+ await postprocessUpdateAsync(reader, exceptions, token);
+ }
+
+
+ public override Marten.Internal.Operations.OperationRole Role()
+ {
+ return Marten.Internal.Operations.OperationRole.Update;
+ }
+
+
+ public override NpgsqlTypes.NpgsqlDbType DbType()
+ {
+ return NpgsqlTypes.NpgsqlDbType.Uuid;
+ }
+
+
+ public override void ConfigureParameters(Weasel.Postgresql.IGroupedParameterBuilder parameterBuilder, Weasel.Postgresql.ICommandBuilder builder, JasperFx.Events.Daemon.DeadLetterEvent document, Marten.Internal.IMartenSession session)
+ {
+ builder.Append("select trainers.mt_update_deadletterevent(");
+ var parameter0 = parameterBuilder.AppendParameter(session.Serializer.ToJson(_document));
+ parameter0.NpgsqlDbType = NpgsqlTypes.NpgsqlDbType.Jsonb;
+ // .Net Class Type
+ var parameter1 = parameterBuilder.AppendParameter(_document.GetType().FullName);
+ parameter1.NpgsqlDbType = NpgsqlTypes.NpgsqlDbType.Varchar;
+ var parameter2 = parameterBuilder.AppendParameter((document is JasperFx.Events.Daemon.DeadLetterEvent ? ((JasperFx.Events.Daemon.DeadLetterEvent)document).Id : default(System.Guid)));
+ setVersionParameter(parameterBuilder);
+ builder.Append(')');
+ }
+
+ }
+
+ // END: UpdateDeadLetterEventOperation1642069326
+
+
+ // START: QueryOnlyDeadLetterEventSelector1642069326
+ [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")]
+ public sealed class QueryOnlyDeadLetterEventSelector1642069326 : Marten.Internal.CodeGeneration.DocumentSelectorWithOnlySerializer, Marten.Linq.Selectors.ISelector
+ {
+ private readonly Marten.Internal.IMartenSession _session;
+ private readonly Marten.Schema.DocumentMapping _mapping;
+
+ public QueryOnlyDeadLetterEventSelector1642069326(Marten.Internal.IMartenSession session, Marten.Schema.DocumentMapping mapping) : base(session, mapping)
+ {
+ _session = session;
+ _mapping = mapping;
+ }
+
+
+
+ public JasperFx.Events.Daemon.DeadLetterEvent Resolve(System.Data.Common.DbDataReader reader)
+ {
+
+ JasperFx.Events.Daemon.DeadLetterEvent document;
+ document = _serializer.FromJson(reader, 0);
+ return document;
+ }
+
+
+ public async System.Threading.Tasks.Task ResolveAsync(System.Data.Common.DbDataReader reader, System.Threading.CancellationToken token)
+ {
+
+ JasperFx.Events.Daemon.DeadLetterEvent document;
+ document = await _serializer.FromJsonAsync(reader, 0, token).ConfigureAwait(false);
+ return document;
+ }
+
+ }
+
+ // END: QueryOnlyDeadLetterEventSelector1642069326
+
+
+ // START: LightweightDeadLetterEventSelector1642069326
+ [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")]
+ public sealed class LightweightDeadLetterEventSelector1642069326 : Marten.Internal.CodeGeneration.DocumentSelectorWithVersions, Marten.Linq.Selectors.ISelector
+ {
+ private readonly Marten.Internal.IMartenSession _session;
+ private readonly Marten.Schema.DocumentMapping _mapping;
+
+ public LightweightDeadLetterEventSelector1642069326(Marten.Internal.IMartenSession session, Marten.Schema.DocumentMapping mapping) : base(session, mapping)
+ {
+ _session = session;
+ _mapping = mapping;
+ }
+
+
+
+ public JasperFx.Events.Daemon.DeadLetterEvent Resolve(System.Data.Common.DbDataReader reader)
+ {
+ var id = reader.GetFieldValue(0);
+
+ JasperFx.Events.Daemon.DeadLetterEvent document;
+ document = _serializer.FromJson(reader, 1);
+ _session.MarkAsDocumentLoaded(id, document);
+ return document;
+ }
+
+
+ public async System.Threading.Tasks.Task ResolveAsync(System.Data.Common.DbDataReader reader, System.Threading.CancellationToken token)
+ {
+ var id = await reader.GetFieldValueAsync(0, token);
+
+ JasperFx.Events.Daemon.DeadLetterEvent document;
+ document = await _serializer.FromJsonAsync(reader, 1, token).ConfigureAwait(false);
+ _session.MarkAsDocumentLoaded(id, document);
+ return document;
+ }
+
+ }
+
+ // END: LightweightDeadLetterEventSelector1642069326
+
+
+ // START: IdentityMapDeadLetterEventSelector1642069326
+ [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")]
+ public sealed class IdentityMapDeadLetterEventSelector1642069326 : Marten.Internal.CodeGeneration.DocumentSelectorWithIdentityMap, Marten.Linq.Selectors.ISelector
+ {
+ private readonly Marten.Internal.IMartenSession _session;
+ private readonly Marten.Schema.DocumentMapping _mapping;
+
+ public IdentityMapDeadLetterEventSelector1642069326(Marten.Internal.IMartenSession session, Marten.Schema.DocumentMapping mapping) : base(session, mapping)
+ {
+ _session = session;
+ _mapping = mapping;
+ }
+
+
+
+ public JasperFx.Events.Daemon.DeadLetterEvent Resolve(System.Data.Common.DbDataReader reader)
+ {
+ var id = reader.GetFieldValue(0);
+ if (_identityMap.TryGetValue(id, out var existing)) return existing;
+
+ JasperFx.Events.Daemon.DeadLetterEvent document;
+ document = _serializer.FromJson(reader, 1);
+ _session.MarkAsDocumentLoaded(id, document);
+ _identityMap[id] = document;
+ return document;
+ }
+
+
+ public async System.Threading.Tasks.Task ResolveAsync(System.Data.Common.DbDataReader reader, System.Threading.CancellationToken token)
+ {
+ var id = await reader.GetFieldValueAsync(0, token);
+ if (_identityMap.TryGetValue(id, out var existing)) return existing;
+
+ JasperFx.Events.Daemon.DeadLetterEvent document;
+ document = await _serializer.FromJsonAsync(reader, 1, token).ConfigureAwait(false);
+ _session.MarkAsDocumentLoaded(id, document);
+ _identityMap[id] = document;
+ return document;
+ }
+
+ }
+
+ // END: IdentityMapDeadLetterEventSelector1642069326
+
+
+ // START: DirtyTrackingDeadLetterEventSelector1642069326
+ [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")]
+ public sealed class DirtyTrackingDeadLetterEventSelector1642069326 : Marten.Internal.CodeGeneration.DocumentSelectorWithDirtyChecking, Marten.Linq.Selectors.ISelector
+ {
+ private readonly Marten.Internal.IMartenSession _session;
+ private readonly Marten.Schema.DocumentMapping _mapping;
+
+ public DirtyTrackingDeadLetterEventSelector1642069326(Marten.Internal.IMartenSession session, Marten.Schema.DocumentMapping mapping) : base(session, mapping)
+ {
+ _session = session;
+ _mapping = mapping;
+ }
+
+
+
+ public JasperFx.Events.Daemon.DeadLetterEvent Resolve(System.Data.Common.DbDataReader reader)
+ {
+ var id = reader.GetFieldValue(0);
+ if (_identityMap.TryGetValue(id, out var existing)) return existing;
+
+ JasperFx.Events.Daemon.DeadLetterEvent document;
+ document = _serializer.FromJson(reader, 1);
+ _session.MarkAsDocumentLoaded(id, document);
+ _identityMap[id] = document;
+ StoreTracker(_session, document);
+ return document;
+ }
+
+
+ public async System.Threading.Tasks.Task ResolveAsync(System.Data.Common.DbDataReader reader, System.Threading.CancellationToken token)
+ {
+ var id = await reader.GetFieldValueAsync(0, token);
+ if (_identityMap.TryGetValue(id, out var existing)) return existing;
+
+ JasperFx.Events.Daemon.DeadLetterEvent document;
+ document = await _serializer.FromJsonAsync(reader, 1, token).ConfigureAwait(false);
+ _session.MarkAsDocumentLoaded(id, document);
+ _identityMap[id] = document;
+ StoreTracker(_session, document);
+ return document;
+ }
+
+ }
+
+ // END: DirtyTrackingDeadLetterEventSelector1642069326
+
+
+ // START: QueryOnlyDeadLetterEventDocumentStorage1642069326
+ [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")]
+ public sealed class QueryOnlyDeadLetterEventDocumentStorage1642069326 : Marten.Internal.Storage.QueryOnlyDocumentStorage
+ {
+ private readonly Marten.Schema.DocumentMapping _document;
+
+ public QueryOnlyDeadLetterEventDocumentStorage1642069326(Marten.Schema.DocumentMapping document) : base(document)
+ {
+ _document = document;
+ }
+
+
+
+ public override System.Guid AssignIdentity(JasperFx.Events.Daemon.DeadLetterEvent document, string tenantId, Marten.Storage.IMartenDatabase database)
+ {
+ if (document.Id == Guid.Empty) _setter(document, JasperFx.Core.CombGuidIdGeneration.NewGuid());
+ return document.Id;
+ }
+
+
+ public override Marten.Internal.Operations.IStorageOperation Update(JasperFx.Events.Daemon.DeadLetterEvent document, Marten.Internal.IMartenSession session, string tenant)
+ {
+
+ return new Marten.Generated.DocumentStorage.UpdateDeadLetterEventOperation1642069326
+ (
+ document, Identity(document),
+ session.Versions.ForType(),
+ _document
+
+ );
+ }
+
+
+ public override Marten.Internal.Operations.IStorageOperation Insert(JasperFx.Events.Daemon.DeadLetterEvent document, Marten.Internal.IMartenSession session, string tenant)
+ {
+
+ return new Marten.Generated.DocumentStorage.InsertDeadLetterEventOperation1642069326
+ (
+ document, Identity(document),
+ session.Versions.ForType(),
+ _document
+
+ );
+ }
+
+
+ public override Marten.Internal.Operations.IStorageOperation Upsert(JasperFx.Events.Daemon.DeadLetterEvent document, Marten.Internal.IMartenSession session, string tenant)
+ {
+
+ return new Marten.Generated.DocumentStorage.UpsertDeadLetterEventOperation1642069326
+ (
+ document, Identity(document),
+ session.Versions.ForType(),
+ _document
+
+ );
+ }
+
+
+ public override Marten.Internal.Operations.IStorageOperation Overwrite(JasperFx.Events.Daemon.DeadLetterEvent document, Marten.Internal.IMartenSession session, string tenant)
+ {
+ throw new System.NotSupportedException();
+ }
+
+
+ public override System.Guid Identity(JasperFx.Events.Daemon.DeadLetterEvent document)
+ {
+ return document.Id;
+ }
+
+
+ public override Marten.Linq.Selectors.ISelector BuildSelector(Marten.Internal.IMartenSession session)
+ {
+ return new Marten.Generated.DocumentStorage.QueryOnlyDeadLetterEventSelector1642069326(session, _document);
+ }
+
+
+ public override object RawIdentityValue(System.Guid id)
+ {
+ return id;
+ }
+
+
+ public override Npgsql.NpgsqlParameter BuildManyIdParameter(System.Guid[] ids)
+ {
+ return base.BuildManyIdParameter(ids);
+ }
+
+ }
+
+ // END: QueryOnlyDeadLetterEventDocumentStorage1642069326
+
+
+ // START: LightweightDeadLetterEventDocumentStorage1642069326
+ [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")]
+ public sealed class LightweightDeadLetterEventDocumentStorage1642069326 : Marten.Internal.Storage.LightweightDocumentStorage
+ {
+ private readonly Marten.Schema.DocumentMapping _document;
+
+ public LightweightDeadLetterEventDocumentStorage1642069326(Marten.Schema.DocumentMapping document) : base(document)
+ {
+ _document = document;
+ }
+
+
+
+ public override System.Guid AssignIdentity(JasperFx.Events.Daemon.DeadLetterEvent document, string tenantId, Marten.Storage.IMartenDatabase database)
+ {
+ if (document.Id == Guid.Empty) _setter(document, JasperFx.Core.CombGuidIdGeneration.NewGuid());
+ return document.Id;
+ }
+
+
+ public override Marten.Internal.Operations.IStorageOperation Update(JasperFx.Events.Daemon.DeadLetterEvent document, Marten.Internal.IMartenSession session, string tenant)
+ {
+
+ return new Marten.Generated.DocumentStorage.UpdateDeadLetterEventOperation1642069326
+ (
+ document, Identity(document),
+ session.Versions.ForType(),
+ _document
+
+ );
+ }
+
+
+ public override Marten.Internal.Operations.IStorageOperation Insert(JasperFx.Events.Daemon.DeadLetterEvent document, Marten.Internal.IMartenSession session, string tenant)
+ {
+
+ return new Marten.Generated.DocumentStorage.InsertDeadLetterEventOperation1642069326
+ (
+ document, Identity(document),
+ session.Versions.ForType(),
+ _document
+
+ );
+ }
+
+
+ public override Marten.Internal.Operations.IStorageOperation Upsert(JasperFx.Events.Daemon.DeadLetterEvent document, Marten.Internal.IMartenSession session, string tenant)
+ {
+
+ return new Marten.Generated.DocumentStorage.UpsertDeadLetterEventOperation1642069326
+ (
+ document, Identity(document),
+ session.Versions.ForType(),
+ _document
+
+ );
+ }
+
+
+ public override Marten.Internal.Operations.IStorageOperation Overwrite(JasperFx.Events.Daemon.DeadLetterEvent document, Marten.Internal.IMartenSession session, string tenant)
+ {
+ throw new System.NotSupportedException();
+ }
+
+
+ public override System.Guid Identity(JasperFx.Events.Daemon.DeadLetterEvent document)
+ {
+ return document.Id;
+ }
+
+
+ public override Marten.Linq.Selectors.ISelector BuildSelector(Marten.Internal.IMartenSession session)
+ {
+ return new Marten.Generated.DocumentStorage.LightweightDeadLetterEventSelector1642069326(session, _document);
+ }
+
+
+ public override object RawIdentityValue(System.Guid id)
+ {
+ return id;
+ }
+
+
+ public override Npgsql.NpgsqlParameter BuildManyIdParameter(System.Guid[] ids)
+ {
+ return base.BuildManyIdParameter(ids);
+ }
+
+ }
+
+ // END: LightweightDeadLetterEventDocumentStorage1642069326
+
+
+ // START: IdentityMapDeadLetterEventDocumentStorage1642069326
+ [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")]
+ public sealed class IdentityMapDeadLetterEventDocumentStorage1642069326 : Marten.Internal.Storage.IdentityMapDocumentStorage
+ {
+ private readonly Marten.Schema.DocumentMapping _document;
+
+ public IdentityMapDeadLetterEventDocumentStorage1642069326(Marten.Schema.DocumentMapping document) : base(document)
+ {
+ _document = document;
+ }
+
+
+
+ public override System.Guid AssignIdentity(JasperFx.Events.Daemon.DeadLetterEvent document, string tenantId, Marten.Storage.IMartenDatabase database)
+ {
+ if (document.Id == Guid.Empty) _setter(document, JasperFx.Core.CombGuidIdGeneration.NewGuid());
+ return document.Id;
+ }
+
+
+ public override Marten.Internal.Operations.IStorageOperation Update(JasperFx.Events.Daemon.DeadLetterEvent document, Marten.Internal.IMartenSession session, string tenant)
+ {
+
+ return new Marten.Generated.DocumentStorage.UpdateDeadLetterEventOperation1642069326
+ (
+ document, Identity(document),
+ session.Versions.ForType(),
+ _document
+
+ );
+ }
+
+
+ public override Marten.Internal.Operations.IStorageOperation Insert(JasperFx.Events.Daemon.DeadLetterEvent document, Marten.Internal.IMartenSession session, string tenant)
+ {
+
+ return new Marten.Generated.DocumentStorage.InsertDeadLetterEventOperation1642069326
+ (
+ document, Identity(document),
+ session.Versions.ForType(),
+ _document
+
+ );
+ }
+
+
+ public override Marten.Internal.Operations.IStorageOperation Upsert(JasperFx.Events.Daemon.DeadLetterEvent document, Marten.Internal.IMartenSession session, string tenant)
+ {
+
+ return new Marten.Generated.DocumentStorage.UpsertDeadLetterEventOperation1642069326
+ (
+ document, Identity(document),
+ session.Versions.ForType(),
+ _document
+
+ );
+ }
+
+
+ public override Marten.Internal.Operations.IStorageOperation Overwrite(JasperFx.Events.Daemon.DeadLetterEvent document, Marten.Internal.IMartenSession session, string tenant)
+ {
+ throw new System.NotSupportedException();
+ }
+
+
+ public override System.Guid Identity(JasperFx.Events.Daemon.DeadLetterEvent document)
+ {
+ return document.Id;
+ }
+
+
+ public override Marten.Linq.Selectors.ISelector BuildSelector(Marten.Internal.IMartenSession session)
+ {
+ return new Marten.Generated.DocumentStorage.IdentityMapDeadLetterEventSelector1642069326(session, _document);
+ }
+
+
+ public override object RawIdentityValue(System.Guid id)
+ {
+ return id;
+ }
+
+
+ public override Npgsql.NpgsqlParameter BuildManyIdParameter(System.Guid[] ids)
+ {
+ return base.BuildManyIdParameter(ids);
+ }
+
+ }
+
+ // END: IdentityMapDeadLetterEventDocumentStorage1642069326
+
+
+ // START: DirtyTrackingDeadLetterEventDocumentStorage1642069326
+ [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")]
+ public sealed class DirtyTrackingDeadLetterEventDocumentStorage1642069326 : Marten.Internal.Storage.DirtyCheckedDocumentStorage
+ {
+ private readonly Marten.Schema.DocumentMapping _document;
+
+ public DirtyTrackingDeadLetterEventDocumentStorage1642069326(Marten.Schema.DocumentMapping document) : base(document)
+ {
+ _document = document;
+ }
+
+
+
+ public override System.Guid AssignIdentity(JasperFx.Events.Daemon.DeadLetterEvent document, string tenantId, Marten.Storage.IMartenDatabase database)
+ {
+ if (document.Id == Guid.Empty) _setter(document, JasperFx.Core.CombGuidIdGeneration.NewGuid());
+ return document.Id;
+ }
+
+
+ public override Marten.Internal.Operations.IStorageOperation Update(JasperFx.Events.Daemon.DeadLetterEvent document, Marten.Internal.IMartenSession session, string tenant)
+ {
+
+ return new Marten.Generated.DocumentStorage.UpdateDeadLetterEventOperation1642069326
+ (
+ document, Identity(document),
+ session.Versions.ForType(),
+ _document
+
+ );
+ }
+
+
+ public override Marten.Internal.Operations.IStorageOperation Insert(JasperFx.Events.Daemon.DeadLetterEvent document, Marten.Internal.IMartenSession session, string tenant)
+ {
+
+ return new Marten.Generated.DocumentStorage.InsertDeadLetterEventOperation1642069326
+ (
+ document, Identity(document),
+ session.Versions.ForType(),
+ _document
+
+ );
+ }
+
+
+ public override Marten.Internal.Operations.IStorageOperation Upsert(JasperFx.Events.Daemon.DeadLetterEvent document, Marten.Internal.IMartenSession session, string tenant)
+ {
+
+ return new Marten.Generated.DocumentStorage.UpsertDeadLetterEventOperation1642069326
+ (
+ document, Identity(document),
+ session.Versions.ForType(),
+ _document
+
+ );
+ }
+
+
+ public override Marten.Internal.Operations.IStorageOperation Overwrite(JasperFx.Events.Daemon.DeadLetterEvent document, Marten.Internal.IMartenSession session, string tenant)
+ {
+ throw new System.NotSupportedException();
+ }
+
+
+ public override System.Guid Identity(JasperFx.Events.Daemon.DeadLetterEvent document)
+ {
+ return document.Id;
+ }
+
+
+ public override Marten.Linq.Selectors.ISelector BuildSelector(Marten.Internal.IMartenSession session)
+ {
+ return new Marten.Generated.DocumentStorage.DirtyTrackingDeadLetterEventSelector1642069326(session, _document);
+ }
+
+
+ public override object RawIdentityValue(System.Guid id)
+ {
+ return id;
+ }
+
+
+ public override Npgsql.NpgsqlParameter BuildManyIdParameter(System.Guid[] ids)
+ {
+ return base.BuildManyIdParameter(ids);
+ }
+
+ }
+
+ // END: DirtyTrackingDeadLetterEventDocumentStorage1642069326
+
+
+ // START: DeadLetterEventBulkLoader1642069326
+ [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")]
+ public sealed class DeadLetterEventBulkLoader1642069326 : Marten.Internal.CodeGeneration.BulkLoader
+ {
+ private readonly Marten.Internal.Storage.IDocumentStorage _storage;
+
+ public DeadLetterEventBulkLoader1642069326(Marten.Internal.Storage.IDocumentStorage storage) : base(storage)
+ {
+ _storage = storage;
+ }
+
+
+ public const string MAIN_LOADER_SQL = "COPY trainers.mt_doc_deadletterevent(\"mt_dotnet_type\", \"id\", \"mt_version\", \"data\") FROM STDIN BINARY";
+
+ public const string TEMP_LOADER_SQL = "COPY mt_doc_deadletterevent_temp(\"mt_dotnet_type\", \"id\", \"mt_version\", \"data\") FROM STDIN BINARY";
+
+ public const string COPY_NEW_DOCUMENTS_SQL = "insert into trainers.mt_doc_deadletterevent (\"id\", \"data\", \"mt_version\", \"mt_dotnet_type\", mt_last_modified) (select mt_doc_deadletterevent_temp.\"id\", mt_doc_deadletterevent_temp.\"data\", mt_doc_deadletterevent_temp.\"mt_version\", mt_doc_deadletterevent_temp.\"mt_dotnet_type\", transaction_timestamp() from mt_doc_deadletterevent_temp left join trainers.mt_doc_deadletterevent on mt_doc_deadletterevent_temp.id = trainers.mt_doc_deadletterevent.id where trainers.mt_doc_deadletterevent.id is null)";
+
+ public const string OVERWRITE_SQL = "update trainers.mt_doc_deadletterevent target SET data = source.data, mt_version = source.mt_version, mt_dotnet_type = source.mt_dotnet_type, mt_last_modified = transaction_timestamp() FROM mt_doc_deadletterevent_temp source WHERE source.id = target.id";
+
+ public const string CREATE_TEMP_TABLE_FOR_COPYING_SQL = "create temporary table mt_doc_deadletterevent_temp (like trainers.mt_doc_deadletterevent including defaults)";
+
+
+ public override string CreateTempTableForCopying()
+ {
+ return CREATE_TEMP_TABLE_FOR_COPYING_SQL;
+ }
+
+
+ public override string CopyNewDocumentsFromTempTable()
+ {
+ return COPY_NEW_DOCUMENTS_SQL;
+ }
+
+
+ public override string OverwriteDuplicatesFromTempTable()
+ {
+ return OVERWRITE_SQL;
+ }
+
+
+ public override async System.Threading.Tasks.Task LoadRowAsync(Npgsql.NpgsqlBinaryImporter writer, JasperFx.Events.Daemon.DeadLetterEvent document, Marten.Storage.Tenant tenant, Marten.ISerializer serializer, System.Threading.CancellationToken cancellation)
+ {
+ await writer.WriteAsync(document.GetType().FullName, NpgsqlTypes.NpgsqlDbType.Varchar, cancellation);
+ await writer.WriteAsync(((JasperFx.Events.Daemon.DeadLetterEvent)document).Id, NpgsqlTypes.NpgsqlDbType.Uuid, cancellation);
+ await writer.WriteAsync(JasperFx.Core.CombGuidIdGeneration.NewGuid(), NpgsqlTypes.NpgsqlDbType.Uuid, cancellation);
+ await writer.WriteAsync(serializer.ToJson(document), NpgsqlTypes.NpgsqlDbType.Jsonb, cancellation);
+ }
+
+
+ public override string MainLoaderSql()
+ {
+ return MAIN_LOADER_SQL;
+ }
+
+
+ public override string TempLoaderSql()
+ {
+ return TEMP_LOADER_SQL;
+ }
+
+ }
+
+ // END: DeadLetterEventBulkLoader1642069326
+
+
+ // START: DeadLetterEventProvider1642069326
+ [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")]
+ public sealed class DeadLetterEventProvider1642069326 : Marten.Internal.Storage.DocumentProvider
+ {
+ private readonly Marten.Schema.DocumentMapping _mapping;
+
+ public DeadLetterEventProvider1642069326(Marten.Schema.DocumentMapping mapping) : base(new DeadLetterEventBulkLoader1642069326(new QueryOnlyDeadLetterEventDocumentStorage1642069326(mapping)), new QueryOnlyDeadLetterEventDocumentStorage1642069326(mapping), new LightweightDeadLetterEventDocumentStorage1642069326(mapping), new IdentityMapDeadLetterEventDocumentStorage1642069326(mapping), new DirtyTrackingDeadLetterEventDocumentStorage1642069326(mapping))
+ {
+ _mapping = mapping;
+ }
+
+
+ }
+
+ // END: DeadLetterEventProvider1642069326
+
+
+}
+
diff --git a/src/Http/DeepMiddlewareUsage/Internal/Generated/EventStore/EventStorage.cs b/src/Http/DeepMiddlewareUsage/Internal/Generated/EventStore/EventStorage.cs
new file mode 100644
index 000000000..7c21ecfaf
--- /dev/null
+++ b/src/Http/DeepMiddlewareUsage/Internal/Generated/EventStore/EventStorage.cs
@@ -0,0 +1,375 @@
+//
+#pragma warning disable
+using JasperFx.Events;
+using Marten;
+using System;
+
+namespace Marten.Generated.EventStore
+{
+ // START: GeneratedEventDocumentStorage
+ [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")]
+ public sealed class GeneratedEventDocumentStorage : Marten.Events.EventDocumentStorage
+ {
+ private readonly Marten.StoreOptions _options;
+
+ public GeneratedEventDocumentStorage(Marten.StoreOptions options) : base(options)
+ {
+ _options = options;
+ }
+
+
+
+ public override Marten.Internal.Operations.IStorageOperation AppendEvent(Marten.Events.EventGraph events, Marten.Internal.IMartenSession session, JasperFx.Events.StreamAction stream, JasperFx.Events.IEvent e)
+ {
+ return new Marten.Generated.EventStore.AppendEventOperation(stream, e);
+ }
+
+
+ public override Marten.Internal.Operations.IStorageOperation InsertStream(JasperFx.Events.StreamAction stream)
+ {
+ return new Marten.Generated.EventStore.GeneratedInsertStream(stream);
+ }
+
+
+ public override Marten.Linq.QueryHandlers.IQueryHandler QueryForStream(JasperFx.Events.StreamAction stream)
+ {
+ return new Marten.Generated.EventStore.GeneratedStreamStateQueryHandler(stream.Id);
+ }
+
+
+ public override Marten.Internal.Operations.IStorageOperation UpdateStreamVersion(JasperFx.Events.StreamAction stream)
+ {
+ return new Marten.Generated.EventStore.GeneratedStreamVersionOperation(stream);
+ }
+
+
+ public override void ApplyReaderDataToEvent(System.Data.Common.DbDataReader reader, JasperFx.Events.IEvent e)
+ {
+ if (!reader.IsDBNull(3))
+ {
+ var sequence = reader.GetFieldValue(3);
+ e.Sequence = sequence;
+ }
+ if (!reader.IsDBNull(4))
+ {
+ var id = reader.GetFieldValue(4);
+ e.Id = id;
+ }
+ var streamId = reader.GetFieldValue(5);
+ e.StreamId = streamId;
+ if (!reader.IsDBNull(6))
+ {
+ var version = reader.GetFieldValue(6);
+ e.Version = version;
+ }
+ if (!reader.IsDBNull(7))
+ {
+ var timestamp = reader.GetFieldValue(7);
+ e.Timestamp = timestamp;
+ }
+ if (!reader.IsDBNull(8))
+ {
+ var tenantId = reader.GetFieldValue(8);
+ e.TenantId = tenantId;
+ }
+ var isArchived = reader.GetFieldValue(9);
+ e.IsArchived = isArchived;
+ }
+
+
+ public override async System.Threading.Tasks.Task ApplyReaderDataToEventAsync(System.Data.Common.DbDataReader reader, JasperFx.Events.IEvent e, System.Threading.CancellationToken token)
+ {
+ if (!(await reader.IsDBNullAsync(3, token).ConfigureAwait(false)))
+ {
+ var sequence = await reader.GetFieldValueAsync(3, token).ConfigureAwait(false);
+ e.Sequence = sequence;
+ }
+ if (!(await reader.IsDBNullAsync(4, token).ConfigureAwait(false)))
+ {
+ var id = await reader.GetFieldValueAsync(4, token).ConfigureAwait(false);
+ e.Id = id;
+ }
+ var streamId = await reader.GetFieldValueAsync(5, token).ConfigureAwait(false);
+ e.StreamId = streamId;
+ if (!(await reader.IsDBNullAsync(6, token).ConfigureAwait(false)))
+ {
+ var version = await reader.GetFieldValueAsync(6, token).ConfigureAwait(false);
+ e.Version = version;
+ }
+ if (!(await reader.IsDBNullAsync(7, token).ConfigureAwait(false)))
+ {
+ var timestamp = await reader.GetFieldValueAsync(7, token).ConfigureAwait(false);
+ e.Timestamp = timestamp;
+ }
+ if (!(await reader.IsDBNullAsync(8, token).ConfigureAwait(false)))
+ {
+ var tenantId = await reader.GetFieldValueAsync(8, token).ConfigureAwait(false);
+ e.TenantId = tenantId;
+ }
+ var isArchived = await reader.GetFieldValueAsync(9, token).ConfigureAwait(false);
+ e.IsArchived = isArchived;
+ }
+
+
+ public override Marten.Internal.Operations.IStorageOperation QuickAppendEventWithVersion(JasperFx.Events.StreamAction stream, JasperFx.Events.IEvent e)
+ {
+ return new Marten.Generated.EventStore.AppendEventOperationQuickWithVersion(stream, e);
+ }
+
+
+ public override Marten.Internal.Operations.IStorageOperation QuickAppendEvents(JasperFx.Events.StreamAction stream)
+ {
+ return new Marten.Generated.EventStore.QuickAppendEventsOperation(stream);
+ }
+
+ }
+
+ // END: GeneratedEventDocumentStorage
+
+
+ // START: AppendEventOperation
+ [global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")]
+ public sealed class AppendEventOperation : Marten.Events.Operations.AppendEventOperationBase
+ {
+ private readonly JasperFx.Events.StreamAction _stream;
+ private readonly JasperFx.Events.IEvent _e;
+
+ public AppendEventOperation(JasperFx.Events.StreamAction stream, JasperFx.Events.IEvent e) : base(stream, e)
+ {
+ _stream = stream;
+ _e = e;
+ }
+
+
+
+ public override void ConfigureCommand(Weasel.Postgresql.ICommandBuilder builder, Marten.Internal.IMartenSession session)
+ {
+ builder.Append("insert into trainers.mt_events (data, type, mt_dotnet_type, id, stream_id, version, timestamp, tenant_id, seq_id) values (");
+ var parameterBuilder = builder.CreateGroupedParameterBuilder(',');
+ var parameter0 = parameterBuilder.AppendParameter(session.Serializer.ToJson(Event.Data));
+ parameter0.NpgsqlDbType = NpgsqlTypes.NpgsqlDbType.Jsonb;
+ var parameter1 = Event.EventTypeName != null ? parameterBuilder.AppendParameter(Event.EventTypeName) : parameterBuilder.AppendParameter