diff --git a/docs/configuration/storeoptions.md b/docs/configuration/storeoptions.md index 6064ba3d04..83ef7ddbc2 100644 --- a/docs/configuration/storeoptions.md +++ b/docs/configuration/storeoptions.md @@ -15,7 +15,7 @@ public static DocumentStore For(Action configure) return new DocumentStore(options); } ``` -snippet source | anchor +snippet source | anchor The major parts of `StoreOptions` are shown in the class diagram below: diff --git a/src/Marten/DocumentStore.cs b/src/Marten/DocumentStore.cs index 604b9f3f81..e645186d07 100644 --- a/src/Marten/DocumentStore.cs +++ b/src/Marten/DocumentStore.cs @@ -1,13 +1,17 @@ #nullable enable using System; using System.Collections.Generic; +using System.Linq; using System.Threading; using System.Threading.Tasks; using System.Transactions; +using JasperFx.Core; using JasperFx.Core.Reflection; using Marten.Events; using Marten.Events.Daemon; using Marten.Events.Daemon.HighWater; +using Marten.Events.Daemon.Resiliency; +using Marten.Events.Projections; using Marten.Exceptions; using Marten.Internal.Sessions; using Marten.Schema; @@ -59,6 +63,20 @@ public DocumentStore(StoreOptions options) _identityMapCompiledQueries = new CompiledQueryCollection(DocumentTracking.IdentityOnly, this); _dirtyTrackedCompiledQueries = new CompiledQueryCollection(DocumentTracking.DirtyTracking, this); _queryOnlyCompiledQueries = new CompiledQueryCollection(DocumentTracking.QueryOnly, this); + + warnIfAsyncDaemonIsDisabledWithAsyncProjections(); + } + + private void warnIfAsyncDaemonIsDisabledWithAsyncProjections() + { + if (Options.Projections.HasAnyAsyncProjections() && Options.Projections.AsyncMode == DaemonMode.Disabled) + { + Console.WriteLine("Warning: The async daemon is disabled."); + var asyncProjectionList = + Options.Projections.All.Where(x => x.Lifecycle == ProjectionLifecycle.Async).Select(x => x.ToString())! + .Join(", "); + Console.WriteLine($"Projections {asyncProjectionList} will not be executed without the async daemon enabled"); + } } public ITenancy Tenancy => Options.Tenancy;