Initialize CBDD solution and add a .NET-focused gitignore for generated artifacts.
This commit is contained in:
27
tests/CBDD.Tests/TestExtendedDbContext.cs
Executable file
27
tests/CBDD.Tests/TestExtendedDbContext.cs
Executable file
@@ -0,0 +1,27 @@
|
||||
using ZB.MOM.WW.CBDD.Core.Collections;
|
||||
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.
|
||||
/// </summary>
|
||||
public partial class TestExtendedDbContext : TestDbContext
|
||||
{
|
||||
public DocumentCollection<int, ExtendedEntity> ExtendedEntities { get; set; } = null!;
|
||||
|
||||
public TestExtendedDbContext(string databasePath) : base(databasePath)
|
||||
{
|
||||
InitializeCollections();
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
modelBuilder.Entity<ExtendedEntity>()
|
||||
.ToCollection("extended_entities")
|
||||
.HasKey(e => e.Id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user