zzzprojects/entity框架扩展在System.Linq.Expressions.Expression.Ca



这是我的批量插入函数。

public async Task BulkInsertAsync(IEnumerable<T> entities)
{
await _context.BulkInsertAsync(entities,option => {
option.DisablePrimaryKeyNullCheck = true;
option.DisableSqlBulkCopyDirect = true;
});
}

这是我的实体框架批量插入函数。

public async Task InsertAsync(IEnumerable<T> entities)
{
await _context.AddRangeAsync(entities);
await _context.SaveChangesAsync();
}

批量插入工作正常。但是批量插入函数抛出了一个异常:

{"ClassName"System.TypeInitializationException">
&quot的消息&quot{"ClassName":"System.ArgumentNullException",
"Message":"值不能为null。",
"Data":null,

租户,Int32天),位于C:\Users\503325638\Code\ODW Onboard\ODW monitor\ODW\Server\src\monitor\AllMonitorRouter.cs:line 96"quot;RemoteStackTraceString":null;RemoteStackIndex":0;例外方法":null;HResult":-2146233036;来源":"Z.EntityFramework.EFCore";,

如何解决这个问题?

我的坏。实体框架扩展不会抛出内部异常。问题是postgresql表的列类型是没有时区的时间戳。我换成

timestamp(6) with time zone DEFAULT now();

在dotnet项目中启动.cs

ConfigureServices(){
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
}

所有的东西都不见了。

相关内容

最新更新