简体   繁体   English

在 EF Core 3.1 中替换 MapToStoredProcedures() 的最佳方法是什么?

[英]What is the best method for Replacement of MapToStoredProcedures() in EF Core 3.1?

I have implemented the project of EntityFramework 6 into EntityFramework Core 3.1.我已经将EntityFramework 6的项目实现到EntityFramework Core 3.1中。 Using Roslyn API, I have to do migrate the Properties, Types and Methods of Entity framework.使用 Roslyn API,我必须迁移实体框架的属性、类型和方法。 Now I have struck with MapToStoredProcedures现在我已经使用 MapToStoredProcedures

Sample.cs示例.cs

protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
    modelBuilder.Entity<Student>()
            .MapToStoredProcedures(p => p.Insert(sp => sp.HasName("sp_InsertStudent").Parameter(pm => pm.StudentName, "name").Result(rs => rs.StudentId, "Id"))
                    .Update(sp => sp.HasName("sp_UpdateStudent").Parameter(pm => pm.StudentName, "name"))
                    .Delete(sp => sp.HasName("sp_DeleteStudent").Parameter(pm => pm.StudentId, "Id"))
            );
}

Based on the link https://github.com/dotnet/efcore/issues/245 .基于链接https://github.com/dotnet/efcore/issues/245 there is no more supported in EF core and also most of the stack overflow links are suggested DbContext method.I have no idea about this. EF 核心不再支持,而且大多数堆栈溢出链接都建议使用 DbContext 方法。我对此一无所知。

Kindly suggest on alternative solution on this and how to do in Roslyn API?请就此提出替代解决方案以及如何在 Roslyn API 中执行?

There is no replacement.没有替代品。 Use standard EF Core Save changes.使用标准 EF Core 保存更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM