Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions src/DocumentDbTests/DocumentDbTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
<Compile Include="..\Marten.Testing\Documents\LongDoc.cs">
<Link>LongDoc.cs</Link>
</Compile>
<Compile Include="..\Marten.Testing\Documents\SingleTenantedDocument.cs">
<Link>Documents\SingleTenantedDocument.cs</Link>
</Compile>
<Compile Include="..\Marten.Testing\Documents\StringDoc.cs">
<Link>Documents\StringDoc.cs</Link>
</Compile>
Expand Down
17 changes: 17 additions & 0 deletions src/DocumentDbTests/MultiTenancy/conjoined_multi_tenancy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -773,4 +773,21 @@ public async Task can_delete_a_document_by_id_and_tenant_string()
var blue = theStore.QuerySession("Red");
(await blue.LoadAsync<StringDoc>(target.Id)).ShouldNotBeNull();
}

[Fact]
public async Task store_document_marked_with_single_tenant_attribute()
{
var target = new SingleTenantedDocument { Id = Guid.NewGuid() };

await using (var session = theStore.LightweightSession("Red"))
{
session.Store(target);
await session.SaveChangesAsync();
}

await using (var session = theStore.QuerySession("Blue"))
{
(await session.LoadAsync<SingleTenantedDocument>(target.Id)).ShouldNotBeNull();
}
}
}
10 changes: 10 additions & 0 deletions src/Marten.Testing/Documents/SingleTenantedDocument.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System;
using Marten.Schema;

namespace Marten.Testing.Documents;

[SingleTenanted]
public class SingleTenantedDocument
{
public Guid Id { get; set; }
}
2 changes: 1 addition & 1 deletion src/Marten/Schema/SingleTenantedAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class SingleTenantedAttribute: MartenAttribute
{
public override void Modify(DocumentMapping mapping)
{
mapping.TenancyStyle = TenancyStyle.Conjoined;
mapping.TenancyStyle = TenancyStyle.Single;
if (mapping.Partitioning != null && mapping.Partitioning is ListPartitioning lp &&
lp.PartitionManager is ManagedListPartitions)
{
Expand Down
Loading