Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/StressTests/using_multiple_document_stores_in_same_host.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ public using_multiple_document_stores_in_same_host()
opts.Connection(ConnectionSource.ConnectionString);
opts.DatabaseSchemaName = "second_store";

opts.Policies.AllDocumentsAreMultiTenanted();
opts.Policies.PartitionMultiTenantedDocumentsUsingMartenManagement("tenants");

opts.Schema.For<SomeSingleTenantedDocument>()
.DoNotPartition()
.SingleTenanted();
return opts;
});
});
Expand Down Expand Up @@ -122,11 +128,28 @@ public async Task use_the_generated_store()
target2.ShouldNotBeNull();
}

[Fact]
public async Task use_a_single_tenanted_document_in_multi_tenancy_ancillary_store()
{
var store = theContainer.GetInstance<ISecondStore>();
await using var session = store.LightweightSession();

var singleTenantedDocument = new SomeSingleTenantedDocument(Guid.NewGuid());
session.Store(singleTenantedDocument);

await session.SaveChangesAsync();

await using var query = store.QuerySession();
var target2 = await query.LoadAsync<SomeSingleTenantedDocument>(singleTenantedDocument.Id);
target2.ShouldNotBeNull();
}

public void Dispose()
{
theContainer?.Dispose();
}
}
public record SomeSingleTenantedDocument(Guid Id);

public class additional_document_store_registration_and_optimized_artifact_workflow
{
Expand Down
Loading