簡體   English   中英

實體框架核心錯誤? SaveChanges 拋出選擇

[英]Entity Framework Core bug? SaveChanges throw select

我正在使用 Entity Framework Core 和 .NET 5,我檢測到服務器中一些內存增加的流量。 當我看到控制台日志時,我看到了問題,當SaveChanges調用失敗時,它會拋出所有表和所有記錄的選擇:(

我的數據庫很大,內存滿了。 我一直在搜索互聯網,但找不到任何類似的錯誤。

我希望有人有解決方案。 謝謝

日志:

[10:59:45 WRN] 編譯一個查詢,該查詢通過“包含”或通過投影加載多個集合導航的相關集合,但未配置“QuerySplittingBehavior”。 默認情況下,實體框架將使用“QuerySplittingBehavior.SingleQuery”,這可能會導致查詢性能變慢。 有關詳細信息,請參閱https://go.microsoft.com/fwlink/?linkid=2134277 要識別觸發此警告調用的查詢 'ConfigureWarnings(w => w.Throw(RelationalEventId.MultipleCollectionIncludeWarning))'

[10:59:46 DBG] 生成的查詢執行表達式:'queryContext => new SingleQueryingEnumerable( (RelationalQueryContext)queryContext, RelationalCommandCache.SelectExpression(
投影映射:
SELECT t.Id, t.AceptaTerminosYCondiciones, t.Activo, t.ContactoPrincipalId, t.CreatedBy, t.CurrentTimestamp, t.DateCreated, t.DateEdited, t.EditedBy, t.EstadoId, t.PersonaHumanaId, JuridaIdPerson .TipoPersonaId、t.TipoSujetoObligadoId、t.UsuarioId、p.Id、p.CreatedBy、p.Cuit、p.CurrentTimestamp、p.DateCreated、p.DateEdited、p.EditedBy、p.FechaConstitucion、p.Jurisdiccion、p.NroIns , p.RazonSocial, ....

就我而言,我將其追溯到 Sherilog 的 ExceptionDetails 接收器。

Serilog.Exceptions 正在序列化 DbUpdateException,這可能會導致嘗試遍歷與異常關聯的整個對象圖。 如果您從 Serilog 配置中刪除 .Enrich.WithExceptionDetails(),那么事情會按預期工作。

請在此處查看詳細信息https://github.com/dotnet/efcore/issues/15214

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM