Reformat / cleanup
This commit is contained in:
@@ -1,43 +1,42 @@
|
||||
using ZB.MOM.WW.CBDD.Shared;
|
||||
|
||||
namespace ZB.MOM.WW.CBDD.Tests
|
||||
namespace ZB.MOM.WW.CBDD.Tests;
|
||||
|
||||
public class AutoInitTests : IDisposable
|
||||
{
|
||||
public class AutoInitTests : System.IDisposable
|
||||
private const string DbPath = "autoinit.db";
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AutoInitTests" /> class.
|
||||
/// </summary>
|
||||
public AutoInitTests()
|
||||
{
|
||||
private const string DbPath = "autoinit.db";
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AutoInitTests"/> class.
|
||||
/// </summary>
|
||||
public AutoInitTests()
|
||||
{
|
||||
if (File.Exists(DbPath)) File.Delete(DbPath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Releases test resources.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
if (File.Exists(DbPath)) File.Delete(DbPath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies generated collection initializers set up collections automatically.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void Collections_Are_Initialized_By_Generator()
|
||||
{
|
||||
using var db = new Shared.TestDbContext(DbPath);
|
||||
|
||||
// Verify Collection is not null (initialized by generated method)
|
||||
db.AutoInitEntities.ShouldNotBeNull();
|
||||
|
||||
// Verify we can use it
|
||||
db.AutoInitEntities.Insert(new AutoInitEntity { Id = 1, Name = "Test" });
|
||||
var stored = db.AutoInitEntities.FindById(1);
|
||||
stored.ShouldNotBeNull();
|
||||
stored.Name.ShouldBe("Test");
|
||||
}
|
||||
if (File.Exists(DbPath)) File.Delete(DbPath);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Releases test resources.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
if (File.Exists(DbPath)) File.Delete(DbPath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies generated collection initializers set up collections automatically.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void Collections_Are_Initialized_By_Generator()
|
||||
{
|
||||
using var db = new TestDbContext(DbPath);
|
||||
|
||||
// Verify Collection is not null (initialized by generated method)
|
||||
db.AutoInitEntities.ShouldNotBeNull();
|
||||
|
||||
// Verify we can use it
|
||||
db.AutoInitEntities.Insert(new AutoInitEntity { Id = 1, Name = "Test" });
|
||||
var stored = db.AutoInitEntities.FindById(1);
|
||||
stored.ShouldNotBeNull();
|
||||
stored.Name.ShouldBe("Test");
|
||||
}
|
||||
}
|
||||
@@ -1,27 +1,23 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using ZB.MOM.WW.CBDD.Bson;
|
||||
using ZB.MOM.WW.CBDD.Shared;
|
||||
using Xunit;
|
||||
|
||||
namespace ZB.MOM.WW.CBDD.Tests;
|
||||
|
||||
public class DbContextInheritanceTests : IDisposable
|
||||
{
|
||||
private readonly TestExtendedDbContext _db;
|
||||
private readonly string _dbPath;
|
||||
private readonly Shared.TestExtendedDbContext _db;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DbContextInheritanceTests"/> class.
|
||||
/// Initializes a new instance of the <see cref="DbContextInheritanceTests" /> class.
|
||||
/// </summary>
|
||||
public DbContextInheritanceTests()
|
||||
{
|
||||
_dbPath = Path.Combine(Path.GetTempPath(), $"cbdd_inheritance_{Guid.NewGuid()}.db");
|
||||
_db = new Shared.TestExtendedDbContext(_dbPath);
|
||||
_db = new TestExtendedDbContext(_dbPath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Releases test resources.
|
||||
/// Releases test resources.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
@@ -30,7 +26,7 @@ public class DbContextInheritanceTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies parent collections are initialized in the extended context.
|
||||
/// Verifies parent collections are initialized in the extended context.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void ExtendedContext_Should_Initialize_Parent_Collections()
|
||||
@@ -45,7 +41,7 @@ public class DbContextInheritanceTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies extended context collections are initialized.
|
||||
/// Verifies extended context collections are initialized.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void ExtendedContext_Should_Initialize_Own_Collections()
|
||||
@@ -55,7 +51,7 @@ public class DbContextInheritanceTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies parent collections are usable from the extended context.
|
||||
/// Verifies parent collections are usable from the extended context.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void ExtendedContext_Can_Use_Parent_Collections()
|
||||
@@ -73,7 +69,7 @@ public class DbContextInheritanceTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies extended collections are usable from the extended context.
|
||||
/// Verifies extended collections are usable from the extended context.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void ExtendedContext_Can_Use_Own_Collections()
|
||||
@@ -95,7 +91,7 @@ public class DbContextInheritanceTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies parent and extended collections can be used together.
|
||||
/// Verifies parent and extended collections can be used together.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void ExtendedContext_Can_Use_Both_Parent_And_Own_Collections()
|
||||
@@ -125,4 +121,4 @@ public class DbContextInheritanceTests : IDisposable
|
||||
retrievedExtended.ShouldNotBeNull();
|
||||
retrievedExtended.Description.ShouldBe("Related to John");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
using ZB.MOM.WW.CBDD.Bson;
|
||||
using System.IO.Compression;
|
||||
using System.IO.MemoryMappedFiles;
|
||||
using System.Security.Cryptography;
|
||||
using ZB.MOM.WW.CBDD.Core.Compression;
|
||||
using ZB.MOM.WW.CBDD.Core.Storage;
|
||||
using ZB.MOM.WW.CBDD.Shared;
|
||||
using System.Security.Cryptography;
|
||||
using System.IO.Compression;
|
||||
using System.IO.MemoryMappedFiles;
|
||||
|
||||
namespace ZB.MOM.WW.CBDD.Tests;
|
||||
|
||||
@@ -13,7 +12,7 @@ public class DbContextTests : IDisposable
|
||||
private string _dbPath;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes test file paths for database context tests.
|
||||
/// Initializes test file paths for database context tests.
|
||||
/// </summary>
|
||||
public DbContextTests()
|
||||
{
|
||||
@@ -21,12 +20,27 @@ public class DbContextTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies the basic database context lifecycle works.
|
||||
/// Disposes test resources and cleans up generated files.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
try
|
||||
{
|
||||
CleanupDbFiles(_dbPath);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignore cleanup errors
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies the basic database context lifecycle works.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void DbContext_BasicLifecycle_Works()
|
||||
{
|
||||
using var db = new Shared.TestDbContext(_dbPath);
|
||||
using var db = new TestDbContext(_dbPath);
|
||||
|
||||
var user = new User { Name = "Alice", Age = 30 };
|
||||
var id = db.Users.Insert(user);
|
||||
@@ -38,12 +52,12 @@ public class DbContextTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies multiple CRUD operations execute correctly in one context.
|
||||
/// Verifies multiple CRUD operations execute correctly in one context.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void DbContext_MultipleOperations_Work()
|
||||
{
|
||||
using var db = new Shared.TestDbContext(_dbPath);
|
||||
using var db = new TestDbContext(_dbPath);
|
||||
|
||||
// Insert
|
||||
var alice = new User { Name = "Alice", Age = 30 };
|
||||
@@ -69,32 +83,33 @@ public class DbContextTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies disposing and reopening context preserves persisted data.
|
||||
/// Verifies disposing and reopening context preserves persisted data.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void DbContext_Dispose_ReleasesResources()
|
||||
{
|
||||
_dbPath = Path.Combine(Path.GetTempPath(), $"test_dbcontext_reopen.db");
|
||||
_dbPath = Path.Combine(Path.GetTempPath(), "test_dbcontext_reopen.db");
|
||||
var totalUsers = 0;
|
||||
// First context - insert and dispose (auto-checkpoint)
|
||||
using (var db = new Shared.TestDbContext(_dbPath))
|
||||
using (var db = new TestDbContext(_dbPath))
|
||||
{
|
||||
db.Users.Insert(new User { Name = "Test", Age = 20 });
|
||||
db.SaveChanges(); // Explicitly save changes to ensure data is in WAL
|
||||
var beforeCheckpointTotalUsers = db.Users.FindAll().Count();
|
||||
int beforeCheckpointTotalUsers = db.Users.FindAll().Count();
|
||||
db.ForceCheckpoint(); // Force checkpoint to ensure data is persisted to main file
|
||||
totalUsers = db.Users.FindAll().Count();
|
||||
var countedUsers = db.Users.Count();
|
||||
int countedUsers = db.Users.Count();
|
||||
totalUsers.ShouldBe(beforeCheckpointTotalUsers);
|
||||
} // Dispose → Commit → ForceCheckpoint → Write to PageFile
|
||||
|
||||
// Should be able to open again and see persisted data
|
||||
using var db2 = new Shared.TestDbContext(_dbPath);
|
||||
using var db2 = new TestDbContext(_dbPath);
|
||||
|
||||
totalUsers.ShouldBe(1);
|
||||
db2.Users.FindAll().Count().ShouldBe(totalUsers);
|
||||
db2.Users.Count().ShouldBe(totalUsers);
|
||||
}
|
||||
|
||||
private static string ComputeFileHash(string path)
|
||||
{
|
||||
using var stream = File.OpenRead(path);
|
||||
@@ -103,29 +118,31 @@ public class DbContextTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies database file size and content change after insert and checkpoint.
|
||||
/// Verifies database file size and content change after insert and checkpoint.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void DatabaseFile_SizeAndContent_ChangeAfterInsert()
|
||||
{
|
||||
var dbPath = Path.Combine(Path.GetTempPath(), $"test_dbfile_{Guid.NewGuid()}.db");
|
||||
string dbPath = Path.Combine(Path.GetTempPath(), $"test_dbfile_{Guid.NewGuid()}.db");
|
||||
|
||||
// 1. Crea e chiudi database vuoto
|
||||
using (var db = new Shared.TestDbContext(dbPath))
|
||||
using (var db = new TestDbContext(dbPath))
|
||||
{
|
||||
db.Users.Insert(new User { Name = "Pippo", Age = 42 });
|
||||
}
|
||||
var initialSize = new FileInfo(dbPath).Length;
|
||||
var initialHash = ComputeFileHash(dbPath);
|
||||
|
||||
long initialSize = new FileInfo(dbPath).Length;
|
||||
string initialHash = ComputeFileHash(dbPath);
|
||||
|
||||
// 2. Riapri, inserisci, chiudi
|
||||
using (var db = new Shared.TestDbContext(dbPath))
|
||||
using (var db = new TestDbContext(dbPath))
|
||||
{
|
||||
db.Users.Insert(new User { Name = "Test", Age = 42 });
|
||||
db.ForceCheckpoint(); // Forza persistenza
|
||||
}
|
||||
var afterInsertSize = new FileInfo(dbPath).Length;
|
||||
var afterInsertHash = ComputeFileHash(dbPath);
|
||||
|
||||
long afterInsertSize = new FileInfo(dbPath).Length;
|
||||
string afterInsertHash = ComputeFileHash(dbPath);
|
||||
|
||||
// 3. Verifica che dimensione e hash siano cambiati
|
||||
afterInsertSize.ShouldNotBe(initialSize);
|
||||
@@ -133,25 +150,25 @@ public class DbContextTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies the WAL file path is auto-derived from database path.
|
||||
/// Verifies the WAL file path is auto-derived from database path.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void DbContext_AutoDerivesWalPath()
|
||||
{
|
||||
using var db = new Shared.TestDbContext(_dbPath);
|
||||
using var db = new TestDbContext(_dbPath);
|
||||
db.Users.Insert(new User { Name = "Test", Age = 20 });
|
||||
|
||||
var walPath = Path.ChangeExtension(_dbPath, ".wal");
|
||||
string walPath = Path.ChangeExtension(_dbPath, ".wal");
|
||||
File.Exists(walPath).ShouldBeTrue();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies custom page file and compression options support roundtrip data access.
|
||||
/// Verifies custom page file and compression options support roundtrip data access.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void DbContext_WithCustomPageFileAndCompressionOptions_ShouldSupportRoundTrip()
|
||||
{
|
||||
var dbPath = Path.Combine(Path.GetTempPath(), $"test_dbcontext_compression_{Guid.NewGuid():N}.db");
|
||||
string dbPath = Path.Combine(Path.GetTempPath(), $"test_dbcontext_compression_{Guid.NewGuid():N}.db");
|
||||
var options = new CompressionOptions
|
||||
{
|
||||
EnableCompression = true,
|
||||
@@ -170,8 +187,8 @@ public class DbContextTests : IDisposable
|
||||
|
||||
try
|
||||
{
|
||||
using var db = new Shared.TestDbContext(dbPath, config, options);
|
||||
var payload = string.Concat(Enumerable.Repeat("compressible-", 3000));
|
||||
using var db = new TestDbContext(dbPath, config, options);
|
||||
string payload = string.Concat(Enumerable.Repeat("compressible-", 3000));
|
||||
var id = db.Users.Insert(new User { Name = payload, Age = 77 });
|
||||
db.SaveChanges();
|
||||
|
||||
@@ -187,19 +204,16 @@ public class DbContextTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies compact API returns stats and preserves data consistency.
|
||||
/// Verifies compact API returns stats and preserves data consistency.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void DbContext_CompactApi_ShouldReturnStatsAndPreserveData()
|
||||
{
|
||||
var dbPath = Path.Combine(Path.GetTempPath(), $"test_dbcontext_compact_{Guid.NewGuid():N}.db");
|
||||
string dbPath = Path.Combine(Path.GetTempPath(), $"test_dbcontext_compact_{Guid.NewGuid():N}.db");
|
||||
try
|
||||
{
|
||||
using var db = new Shared.TestDbContext(dbPath);
|
||||
for (var i = 0; i < 120; i++)
|
||||
{
|
||||
db.Users.Insert(new User { Name = $"compact-{i:D3}", Age = i % 20 });
|
||||
}
|
||||
using var db = new TestDbContext(dbPath);
|
||||
for (var i = 0; i < 120; i++) db.Users.Insert(new User { Name = $"compact-{i:D3}", Age = i % 20 });
|
||||
|
||||
db.SaveChanges();
|
||||
db.Users.Count().ShouldBe(120);
|
||||
@@ -221,29 +235,14 @@ public class DbContextTests : IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disposes test resources and cleans up generated files.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
try
|
||||
{
|
||||
CleanupDbFiles(_dbPath);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignore cleanup errors
|
||||
}
|
||||
}
|
||||
|
||||
private static void CleanupDbFiles(string dbPath)
|
||||
{
|
||||
if (File.Exists(dbPath)) File.Delete(dbPath);
|
||||
|
||||
var walPath = Path.ChangeExtension(dbPath, ".wal");
|
||||
string walPath = Path.ChangeExtension(dbPath, ".wal");
|
||||
if (File.Exists(walPath)) File.Delete(walPath);
|
||||
|
||||
var markerPath = $"{dbPath}.compact.state";
|
||||
if (File.Exists(markerPath)) File.Delete(markerPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,36 +1,48 @@
|
||||
using ZB.MOM.WW.CBDD.Bson;
|
||||
using ZB.MOM.WW.CBDD.Shared;
|
||||
using System.Linq;
|
||||
|
||||
namespace ZB.MOM.WW.CBDD.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// Tests for Source Generator enhancements:
|
||||
/// 1. Property inheritance from base classes (including Id)
|
||||
/// 2. Exclusion of computed getter-only properties
|
||||
/// 3. Recognition of advanced collection types (HashSet, ISet, LinkedList, etc.)
|
||||
/// Tests for Source Generator enhancements:
|
||||
/// 1. Property inheritance from base classes (including Id)
|
||||
/// 2. Exclusion of computed getter-only properties
|
||||
/// 3. Recognition of advanced collection types (HashSet, ISet, LinkedList, etc.)
|
||||
/// </summary>
|
||||
public class SourceGeneratorFeaturesTests : IDisposable
|
||||
{
|
||||
private readonly TestDbContext _db;
|
||||
private readonly string _dbPath;
|
||||
private readonly string _walPath;
|
||||
private readonly Shared.TestDbContext _db;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SourceGeneratorFeaturesTests"/> class.
|
||||
/// Initializes a new instance of the <see cref="SourceGeneratorFeaturesTests" /> class.
|
||||
/// </summary>
|
||||
public SourceGeneratorFeaturesTests()
|
||||
{
|
||||
_dbPath = Path.Combine(Path.GetTempPath(), $"test_sg_features_{Guid.NewGuid()}.db");
|
||||
_walPath = Path.Combine(Path.GetTempPath(), $"test_sg_features_{Guid.NewGuid()}.wal");
|
||||
|
||||
_db = new Shared.TestDbContext(_dbPath);
|
||||
_db = new TestDbContext(_dbPath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disposes the resources used by this instance.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
_db?.Dispose();
|
||||
|
||||
if (File.Exists(_dbPath))
|
||||
File.Delete(_dbPath);
|
||||
if (File.Exists(_walPath))
|
||||
File.Delete(_walPath);
|
||||
}
|
||||
|
||||
#region Inheritance Tests
|
||||
|
||||
/// <summary>
|
||||
/// Tests derived entity inherits id from base class.
|
||||
/// Tests derived entity inherits id from base class.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void DerivedEntity_InheritsId_FromBaseClass()
|
||||
@@ -57,7 +69,7 @@ public class SourceGeneratorFeaturesTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests derived entity update works with inherited id.
|
||||
/// Tests derived entity update works with inherited id.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void DerivedEntity_Update_WorksWithInheritedId()
|
||||
@@ -90,7 +102,7 @@ public class SourceGeneratorFeaturesTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests derived entity query works with inherited properties.
|
||||
/// Tests derived entity query works with inherited properties.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void DerivedEntity_Query_WorksWithInheritedProperties()
|
||||
@@ -120,7 +132,7 @@ public class SourceGeneratorFeaturesTests : IDisposable
|
||||
#region Computed Properties Tests
|
||||
|
||||
/// <summary>
|
||||
/// Tests computed properties are not serialized.
|
||||
/// Tests computed properties are not serialized.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void ComputedProperties_AreNotSerialized()
|
||||
@@ -151,7 +163,7 @@ public class SourceGeneratorFeaturesTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests computed properties update does not break.
|
||||
/// Tests computed properties update does not break.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void ComputedProperties_UpdateDoesNotBreak()
|
||||
@@ -189,7 +201,7 @@ public class SourceGeneratorFeaturesTests : IDisposable
|
||||
#region Advanced Collections Tests
|
||||
|
||||
/// <summary>
|
||||
/// Tests hash set serializes and deserializes.
|
||||
/// Tests hash set serializes and deserializes.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void HashSet_SerializesAndDeserializes()
|
||||
@@ -219,7 +231,7 @@ public class SourceGeneratorFeaturesTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests iset serializes and deserializes.
|
||||
/// Tests iset serializes and deserializes.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void ISet_SerializesAndDeserializes()
|
||||
@@ -250,7 +262,7 @@ public class SourceGeneratorFeaturesTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests linked list serializes and deserializes.
|
||||
/// Tests linked list serializes and deserializes.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void LinkedList_SerializesAndDeserializes()
|
||||
@@ -281,7 +293,7 @@ public class SourceGeneratorFeaturesTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests queue serializes and deserializes.
|
||||
/// Tests queue serializes and deserializes.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void Queue_SerializesAndDeserializes()
|
||||
@@ -311,7 +323,7 @@ public class SourceGeneratorFeaturesTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests stack serializes and deserializes.
|
||||
/// Tests stack serializes and deserializes.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void Stack_SerializesAndDeserializes()
|
||||
@@ -341,7 +353,7 @@ public class SourceGeneratorFeaturesTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests hash set with nested objects serializes and deserializes.
|
||||
/// Tests hash set with nested objects serializes and deserializes.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void HashSet_WithNestedObjects_SerializesAndDeserializes()
|
||||
@@ -351,8 +363,10 @@ public class SourceGeneratorFeaturesTests : IDisposable
|
||||
{
|
||||
Name = "Test Nested HashSet"
|
||||
};
|
||||
entity.Addresses.Add(new Address { Street = "123 Main St", City = new City { Name = "NYC", ZipCode = "10001" } });
|
||||
entity.Addresses.Add(new Address { Street = "456 Oak Ave", City = new City { Name = "LA", ZipCode = "90001" } });
|
||||
entity.Addresses.Add(
|
||||
new Address { Street = "123 Main St", City = new City { Name = "NYC", ZipCode = "10001" } });
|
||||
entity.Addresses.Add(new Address
|
||||
{ Street = "456 Oak Ave", City = new City { Name = "LA", ZipCode = "90001" } });
|
||||
|
||||
// Act
|
||||
var id = _db.AdvancedCollectionEntities.Insert(entity);
|
||||
@@ -371,7 +385,7 @@ public class SourceGeneratorFeaturesTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests iset with nested objects serializes and deserializes.
|
||||
/// Tests iset with nested objects serializes and deserializes.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void ISet_WithNestedObjects_SerializesAndDeserializes()
|
||||
@@ -403,7 +417,7 @@ public class SourceGeneratorFeaturesTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests advanced collections all types in single entity.
|
||||
/// Tests advanced collections all types in single entity.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void AdvancedCollections_AllTypesInSingleEntity()
|
||||
@@ -454,7 +468,7 @@ public class SourceGeneratorFeaturesTests : IDisposable
|
||||
#region Private Setters Tests
|
||||
|
||||
/// <summary>
|
||||
/// Tests entity with private setters can be deserialized.
|
||||
/// Tests entity with private setters can be deserialized.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void EntityWithPrivateSetters_CanBeDeserialized()
|
||||
@@ -475,7 +489,7 @@ public class SourceGeneratorFeaturesTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests entity with private setters update works.
|
||||
/// Tests entity with private setters update works.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void EntityWithPrivateSetters_Update_Works()
|
||||
@@ -501,7 +515,7 @@ public class SourceGeneratorFeaturesTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests entity with private setters query works.
|
||||
/// Tests entity with private setters query works.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void EntityWithPrivateSetters_Query_Works()
|
||||
@@ -530,7 +544,7 @@ public class SourceGeneratorFeaturesTests : IDisposable
|
||||
#region Init-Only Setters Tests
|
||||
|
||||
/// <summary>
|
||||
/// Tests entity with init setters can be deserialized.
|
||||
/// Tests entity with init setters can be deserialized.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void EntityWithInitSetters_CanBeDeserialized()
|
||||
@@ -557,15 +571,18 @@ public class SourceGeneratorFeaturesTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests entity with init setters query works.
|
||||
/// Tests entity with init setters query works.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void EntityWithInitSetters_Query_Works()
|
||||
{
|
||||
// Arrange
|
||||
var entity1 = new EntityWithInitSetters { Id = ObjectId.NewObjectId(), Name = "Alpha", Age = 20, CreatedAt = DateTime.UtcNow };
|
||||
var entity2 = new EntityWithInitSetters { Id = ObjectId.NewObjectId(), Name = "Beta", Age = 30, CreatedAt = DateTime.UtcNow };
|
||||
var entity3 = new EntityWithInitSetters { Id = ObjectId.NewObjectId(), Name = "Gamma", Age = 40, CreatedAt = DateTime.UtcNow };
|
||||
var entity1 = new EntityWithInitSetters
|
||||
{ Id = ObjectId.NewObjectId(), Name = "Alpha", Age = 20, CreatedAt = DateTime.UtcNow };
|
||||
var entity2 = new EntityWithInitSetters
|
||||
{ Id = ObjectId.NewObjectId(), Name = "Beta", Age = 30, CreatedAt = DateTime.UtcNow };
|
||||
var entity3 = new EntityWithInitSetters
|
||||
{ Id = ObjectId.NewObjectId(), Name = "Gamma", Age = 40, CreatedAt = DateTime.UtcNow };
|
||||
|
||||
_db.InitSetterEntities.Insert(entity1);
|
||||
_db.InitSetterEntities.Insert(entity2);
|
||||
@@ -582,17 +599,4 @@ public class SourceGeneratorFeaturesTests : IDisposable
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Disposes the resources used by this instance.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
_db?.Dispose();
|
||||
|
||||
if (File.Exists(_dbPath))
|
||||
File.Delete(_dbPath);
|
||||
if (File.Exists(_walPath))
|
||||
File.Delete(_walPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,191 +2,220 @@ using ZB.MOM.WW.CBDD.Bson;
|
||||
using ZB.MOM.WW.CBDD.Core;
|
||||
using ZB.MOM.WW.CBDD.Core.Collections;
|
||||
using ZB.MOM.WW.CBDD.Core.Compression;
|
||||
using ZB.MOM.WW.CBDD.Core.Indexing;
|
||||
using ZB.MOM.WW.CBDD.Core.Metadata;
|
||||
using ZB.MOM.WW.CBDD.Core.Storage;
|
||||
using ZB.MOM.WW.CBDD.Core.Transactions;
|
||||
using ZB.MOM.WW.CBDD.Core.Indexing;
|
||||
using ZB.MOM.WW.CBDD.Core.Metadata;
|
||||
using ZB.MOM.WW.CBDD.Core.Storage;
|
||||
using ZB.MOM.WW.CBDD.Core.Transactions;
|
||||
|
||||
namespace ZB.MOM.WW.CBDD.Shared;
|
||||
|
||||
/// <summary>
|
||||
/// Test context with manual collection initialization
|
||||
/// (Source Generator will automate this in the future)
|
||||
/// Test context with manual collection initialization
|
||||
/// (Source Generator will automate this in the future)
|
||||
/// </summary>
|
||||
public partial class TestDbContext : DocumentDbContext
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the AnnotatedUsers.
|
||||
/// Initializes a new instance of the <see cref="TestDbContext" /> class.
|
||||
/// </summary>
|
||||
/// <param name="databasePath">The database path.</param>
|
||||
public TestDbContext(string databasePath)
|
||||
: this(databasePath, PageFileConfig.Default, CompressionOptions.Default)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TestDbContext" /> class.
|
||||
/// </summary>
|
||||
/// <param name="databasePath">The database path.</param>
|
||||
/// <param name="compressionOptions">The compression options.</param>
|
||||
public TestDbContext(string databasePath, CompressionOptions compressionOptions)
|
||||
: this(databasePath, PageFileConfig.Default, compressionOptions)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TestDbContext" /> class.
|
||||
/// </summary>
|
||||
/// <param name="databasePath">The database path.</param>
|
||||
/// <param name="pageFileConfig">The page file configuration.</param>
|
||||
public TestDbContext(string databasePath, PageFileConfig pageFileConfig)
|
||||
: this(databasePath, pageFileConfig, CompressionOptions.Default)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TestDbContext" /> class.
|
||||
/// </summary>
|
||||
/// <param name="databasePath">The database path.</param>
|
||||
/// <param name="pageFileConfig">The page file configuration.</param>
|
||||
/// <param name="compressionOptions">The compression options.</param>
|
||||
/// <param name="maintenanceOptions">The maintenance options.</param>
|
||||
public TestDbContext(
|
||||
string databasePath,
|
||||
PageFileConfig pageFileConfig,
|
||||
CompressionOptions? compressionOptions,
|
||||
MaintenanceOptions? maintenanceOptions = null)
|
||||
: base(databasePath, pageFileConfig, compressionOptions, maintenanceOptions)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the AnnotatedUsers.
|
||||
/// </summary>
|
||||
public DocumentCollection<ObjectId, AnnotatedUser> AnnotatedUsers { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Orders.
|
||||
/// Gets or sets the Orders.
|
||||
/// </summary>
|
||||
public DocumentCollection<OrderId, Order> Orders { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the TestDocuments.
|
||||
/// Gets or sets the TestDocuments.
|
||||
/// </summary>
|
||||
public DocumentCollection<ObjectId, TestDocument> TestDocuments { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the OrderDocuments.
|
||||
/// Gets or sets the OrderDocuments.
|
||||
/// </summary>
|
||||
public DocumentCollection<ObjectId, OrderDocument> OrderDocuments { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ComplexDocuments.
|
||||
/// Gets or sets the ComplexDocuments.
|
||||
/// </summary>
|
||||
public DocumentCollection<ObjectId, ComplexDocument> ComplexDocuments { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Users.
|
||||
/// Gets or sets the Users.
|
||||
/// </summary>
|
||||
public DocumentCollection<ObjectId, User> Users { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ComplexUsers.
|
||||
/// Gets or sets the ComplexUsers.
|
||||
/// </summary>
|
||||
public DocumentCollection<ObjectId, ComplexUser> ComplexUsers { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the AutoInitEntities.
|
||||
/// Gets or sets the AutoInitEntities.
|
||||
/// </summary>
|
||||
public DocumentCollection<int, AutoInitEntity> AutoInitEntities { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the People.
|
||||
/// Gets or sets the People.
|
||||
/// </summary>
|
||||
public DocumentCollection<int, Person> People { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the PeopleV2.
|
||||
/// Gets or sets the PeopleV2.
|
||||
/// </summary>
|
||||
public DocumentCollection<ObjectId, PersonV2> PeopleV2 { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Products.
|
||||
/// Gets or sets the Products.
|
||||
/// </summary>
|
||||
public DocumentCollection<int, Product> Products { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the IntEntities.
|
||||
/// Gets or sets the IntEntities.
|
||||
/// </summary>
|
||||
public DocumentCollection<int, IntEntity> IntEntities { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the StringEntities.
|
||||
/// Gets or sets the StringEntities.
|
||||
/// </summary>
|
||||
public DocumentCollection<string, StringEntity> StringEntities { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the GuidEntities.
|
||||
/// Gets or sets the GuidEntities.
|
||||
/// </summary>
|
||||
public DocumentCollection<Guid, GuidEntity> GuidEntities { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CustomKeyEntities.
|
||||
/// Gets or sets the CustomKeyEntities.
|
||||
/// </summary>
|
||||
public DocumentCollection<string, CustomKeyEntity> CustomKeyEntities { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the AsyncDocs.
|
||||
/// Gets or sets the AsyncDocs.
|
||||
/// </summary>
|
||||
public DocumentCollection<int, AsyncDoc> AsyncDocs { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the SchemaUsers.
|
||||
/// Gets or sets the SchemaUsers.
|
||||
/// </summary>
|
||||
public DocumentCollection<int, SchemaUser> SchemaUsers { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the VectorItems.
|
||||
/// Gets or sets the VectorItems.
|
||||
/// </summary>
|
||||
public DocumentCollection<ObjectId, VectorEntity> VectorItems { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the GeoItems.
|
||||
/// Gets or sets the GeoItems.
|
||||
/// </summary>
|
||||
public DocumentCollection<ObjectId, GeoEntity> GeoItems { get; set; } = null!;
|
||||
|
||||
// Source Generator Feature Tests
|
||||
/// <summary>
|
||||
/// Gets or sets the DerivedEntities.
|
||||
/// Gets or sets the DerivedEntities.
|
||||
/// </summary>
|
||||
public DocumentCollection<ObjectId, DerivedEntity> DerivedEntities { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ComputedPropertyEntities.
|
||||
/// Gets or sets the ComputedPropertyEntities.
|
||||
/// </summary>
|
||||
public DocumentCollection<ObjectId, EntityWithComputedProperties> ComputedPropertyEntities { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the AdvancedCollectionEntities.
|
||||
/// Gets or sets the AdvancedCollectionEntities.
|
||||
/// </summary>
|
||||
public DocumentCollection<ObjectId, EntityWithAdvancedCollections> AdvancedCollectionEntities { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the PrivateSetterEntities.
|
||||
/// Gets or sets the PrivateSetterEntities.
|
||||
/// </summary>
|
||||
public DocumentCollection<ObjectId, EntityWithPrivateSetters> PrivateSetterEntities { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the InitSetterEntities.
|
||||
/// Gets or sets the InitSetterEntities.
|
||||
/// </summary>
|
||||
public DocumentCollection<ObjectId, EntityWithInitSetters> InitSetterEntities { get; set; } = null!;
|
||||
|
||||
// Circular Reference Tests
|
||||
/// <summary>
|
||||
/// Gets or sets the Employees.
|
||||
/// Gets or sets the Employees.
|
||||
/// </summary>
|
||||
public DocumentCollection<ObjectId, Employee> Employees { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CategoryRefs.
|
||||
/// Gets or sets the CategoryRefs.
|
||||
/// </summary>
|
||||
public DocumentCollection<ObjectId, CategoryRef> CategoryRefs { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ProductRefs.
|
||||
/// Gets or sets the ProductRefs.
|
||||
/// </summary>
|
||||
public DocumentCollection<ObjectId, ProductRef> ProductRefs { get; set; } = null!;
|
||||
|
||||
// Nullable String Id Test (UuidEntity scenario with inheritance)
|
||||
/// <summary>
|
||||
/// Gets or sets the MockCounters.
|
||||
/// Gets or sets the MockCounters.
|
||||
/// </summary>
|
||||
public DocumentCollection<string, MockCounter> MockCounters { get; set; } = null!;
|
||||
|
||||
// Temporal Types Test (DateTimeOffset, TimeSpan, DateOnly, TimeOnly)
|
||||
/// <summary>
|
||||
/// Gets or sets the TemporalEntities.
|
||||
/// Gets or sets the TemporalEntities.
|
||||
/// </summary>
|
||||
public DocumentCollection<ObjectId, TemporalEntity> TemporalEntities { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TestDbContext"/> class.
|
||||
/// </summary>
|
||||
/// <param name="databasePath">The database path.</param>
|
||||
public TestDbContext(string databasePath)
|
||||
: this(databasePath, PageFileConfig.Default, CompressionOptions.Default)
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or sets the Storage.
|
||||
/// </summary>
|
||||
public StorageEngine Storage => Engine;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TestDbContext"/> class.
|
||||
/// </summary>
|
||||
/// <param name="databasePath">The database path.</param>
|
||||
/// <param name="compressionOptions">The compression options.</param>
|
||||
public TestDbContext(string databasePath, CompressionOptions compressionOptions)
|
||||
: this(databasePath, PageFileConfig.Default, compressionOptions)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TestDbContext"/> class.
|
||||
/// </summary>
|
||||
/// <param name="databasePath">The database path.</param>
|
||||
/// <param name="pageFileConfig">The page file configuration.</param>
|
||||
public TestDbContext(string databasePath, PageFileConfig pageFileConfig)
|
||||
: this(databasePath, pageFileConfig, CompressionOptions.Default)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TestDbContext"/> class.
|
||||
/// </summary>
|
||||
/// <param name="databasePath">The database path.</param>
|
||||
/// <param name="pageFileConfig">The page file configuration.</param>
|
||||
/// <param name="compressionOptions">The compression options.</param>
|
||||
/// <param name="maintenanceOptions">The maintenance options.</param>
|
||||
public TestDbContext(
|
||||
string databasePath,
|
||||
PageFileConfig pageFileConfig,
|
||||
CompressionOptions? compressionOptions,
|
||||
MaintenanceOptions? maintenanceOptions = null)
|
||||
: base(databasePath, pageFileConfig, compressionOptions, maintenanceOptions)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
/// <inheritdoc />
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<AnnotatedUser>();
|
||||
modelBuilder.Entity<User>().ToCollection("users");
|
||||
@@ -207,11 +236,11 @@ public partial class TestDbContext : DocumentDbContext
|
||||
|
||||
modelBuilder.Entity<VectorEntity>()
|
||||
.ToCollection("vector_items")
|
||||
.HasVectorIndex(x => x.Embedding, dimensions: 3, metric: VectorMetric.L2, name: "idx_vector");
|
||||
.HasVectorIndex(x => x.Embedding, 3, VectorMetric.L2, "idx_vector");
|
||||
|
||||
modelBuilder.Entity<GeoEntity>()
|
||||
.ToCollection("geo_items")
|
||||
.HasSpatialIndex(x => x.Location, name: "idx_spatial");
|
||||
.HasSpatialIndex(x => x.Location, "idx_spatial");
|
||||
|
||||
modelBuilder.Entity<Order>()
|
||||
.HasKey(x => x.Id)
|
||||
@@ -236,25 +265,20 @@ public partial class TestDbContext : DocumentDbContext
|
||||
modelBuilder.Entity<TemporalEntity>().ToCollection("temporal_entities").HasKey(e => e.Id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes ForceCheckpoint.
|
||||
/// </summary>
|
||||
public void ForceCheckpoint()
|
||||
{
|
||||
Engine.Checkpoint();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes ForceCheckpoint with the requested checkpoint mode.
|
||||
/// </summary>
|
||||
/// <param name="mode">Checkpoint mode to execute.</param>
|
||||
public CheckpointResult ForceCheckpoint(CheckpointMode mode)
|
||||
{
|
||||
return Engine.Checkpoint(mode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Storage.
|
||||
/// </summary>
|
||||
public StorageEngine Storage => Engine;
|
||||
}
|
||||
/// <summary>
|
||||
/// Executes ForceCheckpoint.
|
||||
/// </summary>
|
||||
public void ForceCheckpoint()
|
||||
{
|
||||
Engine.Checkpoint();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes ForceCheckpoint with the requested checkpoint mode.
|
||||
/// </summary>
|
||||
/// <param name="mode">Checkpoint mode to execute.</param>
|
||||
public CheckpointResult ForceCheckpoint(CheckpointMode mode)
|
||||
{
|
||||
return Engine.Checkpoint(mode);
|
||||
}
|
||||
}
|
||||
@@ -4,27 +4,27 @@ using ZB.MOM.WW.CBDD.Core.Metadata;
|
||||
namespace ZB.MOM.WW.CBDD.Shared;
|
||||
|
||||
/// <summary>
|
||||
/// Extended test context that inherits from TestDbContext.
|
||||
/// Used to verify that collection initialization works correctly with inheritance.
|
||||
/// Extended test context that inherits from TestDbContext.
|
||||
/// Used to verify that collection initialization works correctly with inheritance.
|
||||
/// </summary>
|
||||
public partial class TestExtendedDbContext : TestDbContext
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the extended entities.
|
||||
/// Initializes a new instance of the <see cref="TestExtendedDbContext" /> class.
|
||||
/// </summary>
|
||||
public DocumentCollection<int, ExtendedEntity> ExtendedEntities { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TestExtendedDbContext"/> class.
|
||||
/// </summary>
|
||||
/// <param name="databasePath">Database file path.</param>
|
||||
public TestExtendedDbContext(string databasePath) : base(databasePath)
|
||||
/// <param name="databasePath">Database file path.</param>
|
||||
public TestExtendedDbContext(string databasePath) : base(databasePath)
|
||||
{
|
||||
InitializeCollections();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
/// <summary>
|
||||
/// Gets or sets the extended entities.
|
||||
/// </summary>
|
||||
public DocumentCollection<int, ExtendedEntity> ExtendedEntities { get; set; } = null!;
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
@@ -32,4 +32,4 @@ public partial class TestExtendedDbContext : TestDbContext
|
||||
.ToCollection("extended_entities")
|
||||
.HasKey(e => e.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user