using BLite.Core.Collections;
using BLite.Core.Metadata;
using BLite.Core.Storage;
using ZB.MOM.WW.CBDDC.Persistence.BLite;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ZB.MOM.WW.CBDDC.Sample.Console;
public partial class SampleDbContext : CBDDCDocumentDbContext
{
///
/// Gets the users collection.
///
public DocumentCollection Users { get; private set; } = null!;
///
/// Gets the todo lists collection.
///
public DocumentCollection TodoLists { get; private set; } = null!;
///
/// Initializes a new instance of the SampleDbContext class using the specified database file path.
///
/// The file system path to the database file. Cannot be null or empty.
public SampleDbContext(string databasePath) : base(databasePath)
{
}
///
/// Initializes a new instance of the SampleDbContext class using the specified database file path and page file
/// configuration.
///
/// The file system path to the database file. Cannot be null or empty.
/// The configuration settings for the page file. Cannot be null.
public SampleDbContext(string databasePath, PageFileConfig config) : base(databasePath, config)
{
}
///
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity()
.ToCollection("Users")
.HasKey(u => u.Id);
modelBuilder.Entity()
.ToCollection("TodoLists")
.HasKey(t => t.Id);
}
}