【发布时间】:2023-02-08 03:50:49
【问题描述】:
在我的 postgres 数据库中,我有一个带有多个参数的表值函数,其中一些是可选的(默认为空)。 我想在我的 net 7 应用程序中映射此功能。 我的上下文定义看起来像这样
public IQueryable<MyEntity> GetMyEntitiesList(Guid a, string b, int c, int? d, bool? e, Guid? f)
=> FromExpression(() => GetMyEntitiesList(a, b, c, d, e, f));
和 OnModelCreating
modelBuilder.HasDbFunction(
typeof(MyContext).GetMethod(nameof(GetMyEntitiesList)),
new[] { typeof(Guid), typeof(string), typeof(int), typeof(int?), typeof(bool?), typeof(Guid?) }
);
当我尝试添加迁移终端输出结果时
无法搭建“System.Reflection.NullabilityInfoContext”类型的 C# 文字。提供者应实施 CoreTypeMapping.GenerateCodeLiteral 以支持在设计时使用它。
我不知道这是什么意思。
我该如何解决这个问题?我错过了什么?
【问题讨论】:
标签: c# postgresql entity-framework-core user-defined-functions