From 22f443f24ea48e8bf3940d0432f00edbb0a86c2f Mon Sep 17 00:00:00 2001
From: sunpengfei <i@angelzzz.com>
Date: 星期四, 11 九月 2025 10:55:49 +0800
Subject: [PATCH] feat:开发

---
 FlexJobApi.EntityFramework.Core/DbContexts/LogDbContext.cs |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/FlexJobApi.EntityFramework.Core/DbContexts/LogDbContext.cs b/FlexJobApi.EntityFramework.Core/DbContexts/LogDbContext.cs
index e08fc14..8585d3d 100644
--- a/FlexJobApi.EntityFramework.Core/DbContexts/LogDbContext.cs
+++ b/FlexJobApi.EntityFramework.Core/DbContexts/LogDbContext.cs
@@ -1,8 +1,10 @@
 锘縰sing FlexJobApi.Core;
+using Furion;
 using Furion.DatabaseAccessor;
 using Microsoft.EntityFrameworkCore;
 using Microsoft.EntityFrameworkCore.Diagnostics;
 using Microsoft.EntityFrameworkCore.Metadata.Builders;
+using Microsoft.Extensions.Configuration;
 using System;
 
 namespace FlexJobApi.EntityFramework.Core;
@@ -14,15 +16,23 @@
     {
     }
 
-    public void OnCreating(ModelBuilder modelBuilder, EntityTypeBuilder entityBuilder, DbContext dbContext, Type dbContextLocator)
+    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
     {
-        DbUtils.OnCreating(modelBuilder, entityBuilder, dbContext, dbContextLocator);
+        base.OnConfiguring(optionsBuilder);
+        optionsBuilder
+            .UseSqlServer(App.Configuration.GetConnectionString("FlexJobApiLog"), options =>
+            {
+                // 鎸囧畾鐩爣鏁版嵁搴撶増鏈负SQL Server 2014
+                options.UseCompatibilityLevel(120); // 120瀵瑰簲SQL Server 2014
+                // 鍙�夛細璁剧疆鎵归噺鎿嶄綔澶у皬锛堟寜闇�璋冩暣锛�
+                options.MaxBatchSize(1000);
+            });
     }
 
     protected override void OnModelCreating(ModelBuilder modelBuilder)
     {
         base.OnModelCreating(modelBuilder);
-        DbUtils.BuildEntityComment(modelBuilder, typeof(LogDbContextLocator)).Wait();
+        DbUtils.BuildEntity(modelBuilder, typeof(LogDbContextLocator)).Wait();
     }
 
     protected override void SavingChangesEvent(DbContextEventData eventData, InterceptionResult<int> result)

--
Gitblit v1.9.1