using FlexJobApi.Core;
|
using Furion.DatabaseAccessor;
|
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore.Diagnostics;
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
using System;
|
|
namespace FlexJobApi.EntityFramework.Core;
|
|
[AppDbContext("FlexJobApi", DbProvider.SqlServer)]
|
public class DefaultDbContext : AppDbContext<DefaultDbContext>
|
{
|
public DefaultDbContext(DbContextOptions<DefaultDbContext> options) : base(options)
|
{
|
}
|
|
public void OnCreating(ModelBuilder modelBuilder, EntityTypeBuilder entityBuilder, DbContext dbContext, Type dbContextLocator)
|
{
|
DbUtils.OnCreating(modelBuilder, entityBuilder, dbContext, dbContextLocator);
|
}
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
{
|
base.OnModelCreating(modelBuilder);
|
DbUtils.BuildEntityComment(modelBuilder).Wait();
|
}
|
|
protected override void SavingChangesEvent(DbContextEventData eventData, InterceptionResult<int> result)
|
{
|
DbUtils.SavingChangesEvent(eventData, result);
|
}
|
}
|