【发布时间】:2020-03-01 23:28:18
【问题描述】:
在this article 之后,我尝试使用 Entity Framework Core 将内部 SQL 函数调用到我的应用程序中
我在上下文中创建了静态方法,如下所示:
public class DbContext : DbContext
{
public DbContext(DbContextOptions<DbContext> options) : base(options)
{
}
[DbFunction("FN_ENCRYPT", "DBO")]
public static string FN_ENCRYPT(string ENC)
{
throw new NotImplementedException();
}
}
在这之后,我对如何调用它有点困惑,所以我尝试了这种方式(因为它是静态方法,当然):
public string Encript(string word)
{
return DbContext.FN_ENCRYPT(word);
}
但是,你猜怎么着?我收到了一个“不错的”NotImplementedException :)
有人可以帮帮我吗?
提前致谢
【问题讨论】:
标签: asp.net entity-framework asp.net-core entity-framework-core