在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:)
有人可以帮我吗?
预先感谢