diff --git a/.github/workflows/docs-prs.yml b/.github/workflows/docs-prs.yml
index 283661b9fe..b03249c709 100644
--- a/.github/workflows/docs-prs.yml
+++ b/.github/workflows/docs-prs.yml
@@ -47,6 +47,11 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: 9.0.x
+
+ - name: Install .NET 10.0.x
+ uses: actions/setup-dotnet@v3
+ with:
+ dotnet-version: 10.0.x
- name: Build docs
run: ./build.sh docs-build
\ No newline at end of file
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 8cdeb7ec51..00cee805a7 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -46,6 +46,11 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: 9.0.x
+
+ - name: Install .NET 10.0.x
+ uses: actions/setup-dotnet@v3
+ with:
+ dotnet-version: 10.0.x
- name: Build & Deploy docs preview
run: |
diff --git a/.github/workflows/on-manual-do-nuget-publish.yml b/.github/workflows/on-manual-do-nuget-publish.yml
index 2e75d8b72e..3242c49e2b 100644
--- a/.github/workflows/on-manual-do-nuget-publish.yml
+++ b/.github/workflows/on-manual-do-nuget-publish.yml
@@ -25,6 +25,11 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: 9.0.x
+
+ - name: Install .NET 10.0.x
+ uses: actions/setup-dotnet@v3
+ with:
+ dotnet-version: 10.0.x
- name: Install .NET Aspire workload
run: |
diff --git a/.github/workflows/on-push-do-ci-build-pg15-jsonnet.yml b/.github/workflows/on-push-do-ci-build-pg15-jsonnet.yml
index 85fbd76a9a..6008ebf132 100644
--- a/.github/workflows/on-push-do-ci-build-pg15-jsonnet.yml
+++ b/.github/workflows/on-push-do-ci-build-pg15-jsonnet.yml
@@ -63,6 +63,11 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: 9.0.x
+
+ - name: Install .NET 10.0.x
+ uses: actions/setup-dotnet@v3
+ with:
+ dotnet-version: 10.0.x
- name: Install .NET Aspire workload
run: |
diff --git a/.github/workflows/on-push-do-ci-build-pgLatest-systemtextjson.yml b/.github/workflows/on-push-do-ci-build-pgLatest-systemtextjson.yml
index 6e8f7a1430..ab2879e9d6 100644
--- a/.github/workflows/on-push-do-ci-build-pgLatest-systemtextjson.yml
+++ b/.github/workflows/on-push-do-ci-build-pgLatest-systemtextjson.yml
@@ -63,6 +63,11 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: 9.0.x
+
+ - name: Install .NET 10.0.x
+ uses: actions/setup-dotnet@v3
+ with:
+ dotnet-version: 10.0.x
- name: Install .NET Aspire workload
run: |
diff --git a/Directory.Build.props b/Directory.Build.props
index deb5455eae..ef4eca60bb 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -1,7 +1,7 @@
- 8.14.0
+ 8.15.012.0Jeremy D. Miller;Babu Annamalai;Jaedyn Toneehttps://martendb.io/logo.png
@@ -9,7 +9,7 @@
MIT1570;1571;1572;1573;1574;1587;1591;1701;1702;1711;1735;0618https://github.com/JasperFx/marten
- net8.0;net9.0
+ net8.0;net9.0;net10.0
diff --git a/docs/configuration/cli.md b/docs/configuration/cli.md
index 89ccd3ca42..9393c17cca 100644
--- a/docs/configuration/cli.md
+++ b/docs/configuration/cli.md
@@ -29,7 +29,7 @@ scenarios.
To use the expanded command line options to a .NET application, add this last line of code shown below to your `Program.cs`:
-
+
```cs
var builder = WebApplication.CreateBuilder(args);
@@ -37,20 +37,20 @@ var builder = WebApplication.CreateBuilder(args);
// Must be done before calling builder.Build() at least
builder.Host.ApplyJasperFxExtensions();
```
-snippet source | anchor
+snippet source | anchor
And finally, use JasperFx as the command line parser and executor by replacing `App.Run()` as the last line of code in your
`Program.cs` file:
-
+
```cs
// Instead of App.Run(), use the app.RunJasperFxCommands(args)
// as the last line of your Program.cs file
return await app.RunJasperFxCommands(args);
```
-snippet source | anchor
+snippet source | anchor
In your command line in the project directory, you can run:
diff --git a/docs/configuration/hostbuilder.md b/docs/configuration/hostbuilder.md
index d61eb2978e..d2606b3f17 100644
--- a/docs/configuration/hostbuilder.md
+++ b/docs/configuration/hostbuilder.md
@@ -3,7 +3,7 @@
As briefly shown in the [getting started](/) page, Marten comes with the `AddMarten()` extension method for the .NET `IServiceCollection` to quickly add Marten to any ASP.NET Core or Worker Service application:
-
+
```cs
// This is the absolute, simplest way to integrate Marten into your
// .NET application with Marten's default configuration
@@ -26,7 +26,7 @@ builder.Services.AddMarten(options =>
// string to Marten
.UseNpgsqlDataSource();
```
-snippet source | anchor
+snippet source | anchor
The `AddMarten()` method will add these service registrations to your application:
@@ -61,20 +61,20 @@ All the examples in this page are assuming the usage of the default IoC containe
First, if you are using Marten completely out of the box with no customizations (besides attributes on your documents), you can just supply a connection string to the underlying Postgresql database like this:
-
+
```cs
var connectionString = Configuration.GetConnectionString("postgres");
// By only the connection string
services.AddMarten(connectionString);
```
-snippet source | anchor
+snippet source | anchor
The second option is to supply a [nested closure](https://martinfowler.com/dslCatalog/nestedClosure.html) to configure Marten inline like so:
-
+
```cs
var connectionString = Configuration.GetConnectionString("postgres");
@@ -91,13 +91,13 @@ services.CritterStackDefaults(x =>
x.Production.ResourceAutoCreate = AutoCreate.None;
});
```
-snippet source | anchor
+snippet source | anchor
Lastly, if you prefer, you can pass a Marten `StoreOptions` object to `AddMarten()` like this example:
-
+
```cs
var connectionString = Configuration.GetConnectionString("postgres");
@@ -105,6 +105,8 @@ var connectionString = Configuration.GetConnectionString("postgres");
var options = new StoreOptions();
options.Connection(connectionString);
+services.AddMarten(options);
+
// In a "Production" environment, we're turning off the
// automatic database migrations and dynamic code generation
services.CritterStackDefaults(x =>
@@ -113,7 +115,7 @@ services.CritterStackDefaults(x =>
x.Production.ResourceAutoCreate = AutoCreate.None;
});
```
-snippet source | anchor
+snippet source | anchor
## Using NpgsqlDataSource
@@ -130,7 +132,7 @@ You can also use the [NpgsqlDataSource](https://www.npgsql.org/doc/basic-usage.h
You can use the `AddNpgsqlDataSource` method from [Npgsql.DependencyInjection package](https://www.nuget.org/packages/Npgsql.DependencyInjection) to perform a setup by calling the `UseNpgsqlDataSourceMethod`:
-
+
```cs
services.AddNpgsqlDataSource(ConnectionSource.ConnectionString);
@@ -138,13 +140,13 @@ services.AddMarten()
.UseLightweightSessions()
.UseNpgsqlDataSource();
```
-snippet source | anchor
+snippet source | anchor
If you're on .NET 8 (and above), you can also use a dedicated [keyed registration](https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-8#keyed-di-services). This can be useful for scenarios where you need more than one data source registered:
-
+
```cs
const string dataSourceKey = "marten_data_source";
@@ -154,7 +156,7 @@ services.AddMarten()
.UseLightweightSessions()
.UseNpgsqlDataSource(dataSourceKey);
```
-snippet source | anchor
+snippet source | anchor
## Using a Multi-Host Data Source
@@ -164,7 +166,7 @@ Marten includes support for `NpgsqlMultiHostDataSource`, allowing you to spread
Configuring `NpgsqlMultiHostDataSource` is very similar to a normal data source, simply swapping it for `AddMultiHostNpgsqlDataSource`. Marten will always use the primary node for queries with a `NpgsqlMultiHostDataSource` unless you explicitly opt to use the standby nodes. You can adjust what type of node Marten uses for querying via the `MultiHostSettings` store options:
-
+
```cs
services.AddMultiHostNpgsqlDataSource(ConnectionSource.ConnectionString);
@@ -176,7 +178,7 @@ services.AddMarten(x =>
.UseLightweightSessions()
.UseNpgsqlDataSource();
```
-snippet source | anchor
+snippet source | anchor
::: warning
@@ -197,7 +199,7 @@ The `AddMarten()` mechanism assumes that you are expressing all of the Marten co
Fear not, Marten V5.0 introduced a new way to add or modify the Marten configuration from `AddMarten()`. Let's assume that we're building a system that has a subsystem related to *users* and want to segregate all the service registrations and Marten configuration related to *users* into a single place like this extension method:
-
+
```cs
public static IServiceCollection AddUserModule(this IServiceCollection services)
{
@@ -214,7 +216,7 @@ public static IServiceCollection AddUserModule(this IServiceCollection services)
return services;
}
```
-snippet source | anchor
+snippet source | anchor
And next, let's put that into context with its usage inside your application's bootstrapping:
@@ -242,7 +244,7 @@ The `ConfigureMarten()` method is the interesting part of the code samples above
service that implements the `IConfigureMarten` interface into the underlying IoC container:
-
+
```cs
///
/// Mechanism to register additional Marten configuration that is applied after AddMarten()
@@ -253,13 +255,13 @@ public interface IConfigureMarten
void Configure(IServiceProvider services, StoreOptions options);
}
```
-snippet source | anchor
+snippet source | anchor
You could alternatively implement a custom `IConfigureMarten` (or `IConfigureMarten where T : IDocumentStore` if you're working with multiple databases class like so:
-
+
```cs
internal class UserMartenConfiguration: IConfigureMarten
{
@@ -270,13 +272,13 @@ internal class UserMartenConfiguration: IConfigureMarten
}
}
```
-snippet source | anchor
+snippet source | anchor
and registering it in your IoC container something like this:
-
+
```cs
public static IServiceCollection AddUserModule2(this IServiceCollection services)
{
@@ -293,7 +295,7 @@ public static IServiceCollection AddUserModule2(this IServiceCollection services
return services;
}
```
-snippet source | anchor
+snippet source | anchor
### Using IoC Services for Configuring Marten
@@ -305,7 +307,7 @@ be used to selectively configure Marten using potentially asynchronous methods a
That interface signature is:
-
+
```cs
///
/// Mechanism to register additional Marten configuration that is applied after AddMarten()
@@ -317,13 +319,13 @@ public interface IAsyncConfigureMarten
ValueTask Configure(StoreOptions options, CancellationToken cancellationToken);
}
```
-snippet source | anchor
+snippet source | anchor
As an example from the tests, here's a custom version that uses the Feature Management service:
-
+
```cs
public class FeatureManagementUsingExtension: IAsyncConfigureMarten
{
@@ -343,7 +345,7 @@ public class FeatureManagementUsingExtension: IAsyncConfigureMarten
}
}
```
-snippet source | anchor
+snippet source | anchor
And lastly, these extensions can be registered directly against `IServiceCollection` like so:
@@ -369,7 +371,7 @@ compatibility with early Marten and RavenDb behavior before that. To opt into us
without the identity map behavior, use this syntax:
-
+
```cs
var connectionString = Configuration.GetConnectionString("postgres");
@@ -382,7 +384,7 @@ services.AddMarten(opts =>
// session factory behavior
.UseLightweightSessions();
```
-snippet source | anchor
+snippet source | anchor
## Customizing Session Creation Globally
@@ -391,7 +393,7 @@ By default, Marten will create a document session with the basic identity map en
as shown in this example:
-
+
```cs
public class CustomSessionFactory: ISessionFactory
{
@@ -419,13 +421,13 @@ public class CustomSessionFactory: ISessionFactory
}
}
```
-snippet source | anchor
+snippet source | anchor
To register the custom session factory, use the `BuildSessionsWith()` method as shown in this example:
-
+
```cs
var connectionString = Configuration.GetConnectionString("postgres");
@@ -446,7 +448,7 @@ services.CritterStackDefaults(x =>
x.Production.ResourceAutoCreate = AutoCreate.None;
});
```
-snippet source | anchor
+snippet source | anchor
The session factories can also be used to build out and attach custom `IDocumentSessionListener` objects or replace the logging as we'll see in the next section.
@@ -461,20 +463,20 @@ session identification in your application? That's now possible by using a custo
Taking the example of an ASP.NET Core application, let's say that you have a small service scoped to an HTTP request that tracks a correlation identifier for the request like this:
-
+
```cs
public interface ISession
{
Guid CorrelationId { get; set; }
}
```
-snippet source | anchor
+snippet source | anchor
And a custom Marten session logger to add the correlation identifier to the log output like this:
-
+
```cs
public class CorrelatedMartenLogger: IMartenSessionLogger
{
@@ -528,13 +530,13 @@ public class CorrelatedMartenLogger: IMartenSessionLogger
}
}
```
-snippet source | anchor
+snippet source | anchor
Now, let's move on to building out a custom session factory that will attach our correlated marten logger to sessions being resolved from the IoC container:
-
+
```cs
public class ScopedSessionFactory: ISessionFactory
{
@@ -568,13 +570,13 @@ public class ScopedSessionFactory: ISessionFactory
}
}
```
-snippet source | anchor
+snippet source | anchor
Lastly, let's register our new session factory, but this time we need to take care to register the session factory as `Scoped` in the underlying container so we're using the correct `ISession` at runtime:
-
+
```cs
var connectionString = Configuration.GetConnectionString("postgres");
@@ -594,7 +596,7 @@ services.CritterStackDefaults(x =>
x.Production.ResourceAutoCreate = AutoCreate.None;
});
```
-snippet source | anchor
+snippet source | anchor
::: tip
@@ -621,7 +623,7 @@ To utilize the type system and your application's underlying IoC container, the
below targeting a separate "invoicing" database:
-
+
```cs
// These marker interfaces *must* be public
public interface IInvoicingStore : IDocumentStore
@@ -629,7 +631,7 @@ public interface IInvoicingStore : IDocumentStore
}
```
-snippet source | anchor
+snippet source | anchor
A couple notes on the interface:
@@ -640,7 +642,7 @@ A couple notes on the interface:
And now to bootstrap that separate store in our system:
-
+
```cs
using var host = Host.CreateDefaultBuilder()
.ConfigureServices(services =>
@@ -675,14 +677,14 @@ using var host = Host.CreateDefaultBuilder()
});
}).StartAsync();
```
-snippet source | anchor
+snippet source | anchor
At runtime we can inject an instance of our new `IInvoicingStore` and work with it like any other
Marten `IDocumentStore` as shown below in an internal `InvoicingService`:
-
+
```cs
public class InvoicingService
{
@@ -705,5 +707,5 @@ public class InvoicingService
}
}
```
-snippet source | anchor
+snippet source | anchor
diff --git a/docs/configuration/ioc.md b/docs/configuration/ioc.md
index 4b1992ca48..6ff101b0e7 100644
--- a/docs/configuration/ioc.md
+++ b/docs/configuration/ioc.md
@@ -20,7 +20,7 @@ use the `AddMarten()` method directly with Lamar as well.
Using [Lamar](https://jasperfx.github.io/lamar) as the example container, we recommend registering Marten something like this:
-
+
```cs
public class MartenServices : ServiceRegistry
{
@@ -49,7 +49,7 @@ public class MartenServices : ServiceRegistry
}
}
```
-snippet source | anchor
+snippet source | anchor
There are really only two key points here:
diff --git a/docs/configuration/json.md b/docs/configuration/json.md
index 5862b162d4..d008dabce2 100644
--- a/docs/configuration/json.md
+++ b/docs/configuration/json.md
@@ -232,7 +232,7 @@ Please talk to the Marten team before you undergo any significant effort to supp
Internally, Marten uses an adapter interface for JSON serialization:
-
+
```cs
///
/// When selecting data through Linq Select() transforms,
@@ -338,7 +338,7 @@ public interface ISerializer
string ToJsonWithTypes(object document);
}
```
-snippet source | anchor
+snippet source | anchor
To support a new serialization library or customize the JSON serialization options, you can write a new version of `ISerializer` and plug it
diff --git a/docs/configuration/multitenancy.md b/docs/configuration/multitenancy.md
index 6d03a3bb65..2de52cd990 100644
--- a/docs/configuration/multitenancy.md
+++ b/docs/configuration/multitenancy.md
@@ -267,7 +267,7 @@ It is strongly recommended that you first refer to the existing Marten options f
The multi-tenancy strategy is pluggable. Start by implementing the `Marten.Storage.ITenancy` interface:
-
+
```cs
///
/// Pluggable interface for Marten multi-tenancy by database
@@ -306,6 +306,16 @@ public interface ITenancy: IDatabaseSource, IDisposable, IDatabaseUser
///
ValueTask FindOrCreateDatabase(string tenantIdOrDatabaseIdentifier);
+ ///
+ /// Find or create the named database
+ ///
+ ///
+ ///
+ ValueTask FindDatabase(DatabaseId id)
+ {
+ throw new NotImplementedException("You will need to implement this interface method to use a Marten store with Wolverine projection/subscription distribution");
+ }
+
///
/// Asserts that the requested tenant id is part of the current database
///
@@ -314,19 +324,19 @@ public interface ITenancy: IDatabaseSource, IDisposable, IDatabaseUser
bool IsTenantStoredInCurrentDatabase(IMartenDatabase database, string tenantId);
}
```
-snippet source | anchor
+snippet source | anchor
Assuming that we have a custom `ITenancy` model:
-
+
```cs
// Make sure you implement the Dispose() method and
// dispose all MartenDatabase objects
public class MySpecialTenancy: ITenancy
```
-snippet source | anchor
+snippet source | anchor
We can utilize that by applying that model at configuration time:
diff --git a/docs/configuration/retries.md b/docs/configuration/retries.md
index 5263667eda..0e85f71660 100644
--- a/docs/configuration/retries.md
+++ b/docs/configuration/retries.md
@@ -7,7 +7,7 @@ Marten's previous, homegrown `IRetryPolicy` mechanism was completely replaced by
Out of the box, Marten is using [Polly.Core](https://www.pollydocs.org/) for resiliency on most operations with this setup:
-
+
```cs
// default Marten policies
return builder
@@ -22,7 +22,7 @@ return builder
BackoffType = DelayBackoffType.Exponential
});
```
-snippet source | anchor
+snippet source | anchor
The general idea is to have _some_ level of retry with an exponential backoff on typical transient errors encountered
diff --git a/docs/configuration/storeoptions.md b/docs/configuration/storeoptions.md
index 67781d8282..55ae0efc69 100644
--- a/docs/configuration/storeoptions.md
+++ b/docs/configuration/storeoptions.md
@@ -5,7 +5,7 @@ The static builder methods like `DocumentStore.For(configuration)` or `IServiceC
syntactic sugar around building up a `StoreOptions` object and passing that to the constructor function of a `DocumentStore`:
-
+
```cs
public static DocumentStore For(Action configure)
{
@@ -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:
@@ -83,7 +83,7 @@ to compose your document type configuration in additional `MartenRegistry` objec
To use your own subclass of `MartenRegistry` and place declarations in the constructor function like this example:
-
+
```cs
public class OrganizationRegistry: MartenRegistry
{
@@ -94,13 +94,13 @@ public class OrganizationRegistry: MartenRegistry
}
}
```
-snippet source | anchor
+snippet source | anchor
To apply your new `MartenRegistry`, just include it when you bootstrap the `IDocumentStore` as in this example:
-
+
```cs
var store = DocumentStore.For(opts =>
{
@@ -109,7 +109,7 @@ var store = DocumentStore.For(opts =>
opts.Connection(ConnectionSource.ConnectionString);
});
```
-snippet source | anchor
+snippet source | anchor
Do note that you could happily use multiple `MartenRegistry` classes in larger applications if that is advantageous.
@@ -140,7 +140,7 @@ If there's some kind of customization you'd like to use attributes for that isn'
you're still in luck. If you write a subclass of the `MartenAttribute` shown below:
-
+
```cs
public abstract class MartenAttribute: Attribute
{
@@ -167,7 +167,7 @@ public abstract class MartenAttribute: Attribute
public virtual void Register(Type discoveredType, StoreOptions options){}
}
```
-snippet source | anchor
+snippet source | anchor
And decorate either classes or individual field or properties on a document type, your custom attribute will be
@@ -178,7 +178,7 @@ As an example, an attribute to add a gin index to the JSONB storage for more eff
would look like this:
-
+
```cs
[AttributeUsage(AttributeTargets.Class)]
public class GinIndexedAttribute: MartenAttribute
@@ -189,7 +189,7 @@ public class GinIndexedAttribute: MartenAttribute
}
}
```
-snippet source | anchor
+snippet source | anchor
## Embedding Configuration in Document Types
@@ -199,7 +199,7 @@ and invoke that to let the document type make its own customizations for its sto
the unit tests:
-
+
```cs
public class ConfiguresItself
{
@@ -211,7 +211,7 @@ public class ConfiguresItself
}
}
```
-snippet source | anchor
+snippet source | anchor
The `DocumentMapping` type is the core configuration class representing how a document type is persisted or
@@ -222,7 +222,7 @@ You can optionally take in the more specific `DocumentMapping` for your docum
some convenience methods for indexing or duplicating fields that depend on .Net Expression's:
-
+
```cs
public class ConfiguresItselfSpecifically
{
@@ -235,7 +235,7 @@ public class ConfiguresItselfSpecifically
}
}
```
-snippet source | anchor
+snippet source | anchor
## Document Policies
diff --git a/docs/diagnostics.md b/docs/diagnostics.md
index 21c8f515a9..a181ee05e3 100644
--- a/docs/diagnostics.md
+++ b/docs/diagnostics.md
@@ -44,7 +44,7 @@ All of the functionality in this section was added as part of Marten v0.8
Marten has a facility for listening and even intercepting document persistence events with the `IDocumentSessionListener` interface:
-
+
```cs
public interface IChangeListener
{
@@ -106,7 +106,7 @@ public interface IDocumentSessionListener
void DocumentAddedForStorage(object id, object document);
}
```
-snippet source | anchor
+snippet source | anchor
You can build and inject your own listeners by adding them to the `StoreOptions` object you use to configure a `DocumentStore`:
@@ -212,7 +212,7 @@ Listeners will never get activated during projection rebuilds to safe guard agai
A sample listener:
-
+
```cs
public class FakeListener: IChangeListener
{
@@ -237,12 +237,12 @@ public class FakeListener: IChangeListener
}
}
```
-snippet source | anchor
+snippet source | anchor
Wiring a Async Daemon listener:
-
+
```cs
var listener = new FakeListener();
StoreOptions(x =>
@@ -251,7 +251,7 @@ StoreOptions(x =>
x.Projections.AsyncListeners.Add(listener);
});
```
-snippet source | anchor
+snippet source | anchor
## Custom Logging
@@ -259,7 +259,7 @@ StoreOptions(x =>
Marten v0.8 comes with a new mechanism to plug in custom logging to the `IDocumentStore`, `IQuerySession`, and `IDocumentSession` activity:
-
+
```cs
///
/// Records command usage, schema changes, and sessions within Marten
@@ -342,7 +342,7 @@ public interface IMartenSessionLogger
public void OnBeforeExecute(NpgsqlBatch batch);
}
```
-snippet source | anchor
+snippet source | anchor
To apply these logging abstractions, you can either plug your own `IMartenLogger` into the `StoreOptions` object and allow that default logger to create the individual session loggers:
@@ -373,7 +373,7 @@ session.Logger = new RecordingLogger();
The session logging is a different abstraction specifically so that you _could_ track database commands issued per session. In effect, my own shop is going to use this capability to understand what HTTP endpoints or service bus message handlers are being unnecessarily chatty in their database interactions. We also hope that the contextual logging of commands per document session makes it easier to understand how our systems behave.
-
+
```cs
public class ConsoleMartenLogger: IMartenLogger, IMartenSessionLogger
{
@@ -473,7 +473,7 @@ public class ConsoleMartenLogger: IMartenLogger, IMartenSessionLogger
}
}
```
-snippet source | anchor
+snippet source | anchor
## Accessing Diagnostics
diff --git a/docs/documents/aspnetcore.md b/docs/documents/aspnetcore.md
index 9620044b12..ac6f899098 100644
--- a/docs/documents/aspnetcore.md
+++ b/docs/documents/aspnetcore.md
@@ -97,7 +97,7 @@ that allow you to use Linq queries without the runtime overhead of continuously
Back to the sample endpoint above where we write an array of all the open issues. We can express the same query in a simple compiled query like this:
-
+
```cs
public class OpenIssues: ICompiledListQuery
{
@@ -107,7 +107,7 @@ public class OpenIssues: ICompiledListQuery
}
}
```
-snippet source | anchor
+snippet source | anchor
And use that in an MVC Controller method like this:
@@ -131,7 +131,7 @@ sample, here's an example compiled query that reads a single `Issue` document by
id:
-
+
```cs
public class IssueById: ICompiledQuery
{
@@ -143,7 +143,7 @@ public class IssueById: ICompiledQuery
public Guid Id { get; set; }
}
```
-snippet source | anchor
+snippet source | anchor
And the usage of that to write JSON directly to the `HttpContext` in a controller method:
diff --git a/docs/documents/concurrency.md b/docs/documents/concurrency.md
index f5bbd753b7..e25ce1bb06 100644
--- a/docs/documents/concurrency.md
+++ b/docs/documents/concurrency.md
@@ -26,7 +26,7 @@ as being revisioned
In Marten's case, you have to explicitly opt into optimistic versioning for each document type. You can do that with either an attribute on your document type like so:
-
+
```cs
[UseOptimisticConcurrency]
public class CoffeeShop: Shop
@@ -37,7 +37,7 @@ public class CoffeeShop: Shop
public ICollection Employees { get; set; } = new List();
}
```
-snippet source | anchor
+snippet source | anchor
Or by using Marten's configuration API to do it programmatically:
@@ -112,7 +112,7 @@ Marten is throwing an `AggregateException` for the entire batch of changes.
A new feature in Marten V4 is the `IVersioned` marker interface. If your document type implements this interface as shown below:
-
+
```cs
public class MyVersionedDoc: IVersioned
{
@@ -120,7 +120,7 @@ public class MyVersionedDoc: IVersioned
public Guid Version { get; set; }
}
```
-snippet source | anchor
+snippet source | anchor
Your document type will have the optimistic concurrency checks applied to updates _when_ the current version is given to Marten. Moreover, the current version
@@ -143,7 +143,7 @@ You can opt into this behavior on a document by document basis by using the flue
like this:
-
+
```cs
using var store = DocumentStore.For(opts =>
{
@@ -154,7 +154,7 @@ using var store = DocumentStore.For(opts =>
opts.Schema.For().UseNumericRevisions(true);
});
```
-snippet source | anchor
+snippet source | anchor
or by implementing the `IRevisioned` interface in a document type:
diff --git a/docs/documents/deletes.md b/docs/documents/deletes.md
index b8e455fd1f..7e4078ed3f 100644
--- a/docs/documents/deletes.md
+++ b/docs/documents/deletes.md
@@ -50,13 +50,13 @@ public Task DeleteByDocument(IDocumentSession session, User user)
Marten also provides the ability to delete any documents of a certain type meeting a Linq expression using the `IDocumentSession.DeleteWhere()` method:
-
+
```cs
theSession.DeleteWhere(x => x.Double == 578);
await theSession.SaveChangesAsync();
```
-snippet source | anchor
+snippet source | anchor
A couple things to note:
@@ -70,7 +70,7 @@ A couple things to note:
Documents of mixed or varying types can be deleted using `IDocumentSession.DeleteObjects(IEnumerable
diff --git a/src/Marten/Marten.csproj b/src/Marten/Marten.csproj
index 8eb529e183..fda01de57f 100644
--- a/src/Marten/Marten.csproj
+++ b/src/Marten/Marten.csproj
@@ -31,16 +31,20 @@
+
+
+
+
-
-
-
+
+
+
-
+