Files
CBDD/tests/CBDD.Tests/Context/TestExtendedDbContext.cs
Joseph Doherty a70d8befae
All checks were successful
NuGet Publish / build-and-pack (push) Successful in 46s
NuGet Publish / publish-to-gitea (push) Successful in 56s
Reformat / cleanup
2026-02-21 08:10:36 -05:00

35 lines
1.1 KiB
C#
Executable File

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
{
/// <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)
{
InitializeCollections();
}
/// <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);
modelBuilder.Entity<ExtendedEntity>()
.ToCollection("extended_entities")
.HasKey(e => e.Id);
}
}