sunpengfei
2025-08-01 6808e68b5d97cdb39aac1793e7fe30dfbecd7de2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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);
    }
}