从.Net Framework Ado.Net迁移到Net Core

huangapple go评论59阅读模式
英文:

Migrate from .Net Framework Ado.Net to Net Core

问题

我在想...我应该升级一个基于ADO.Net并且有许多存储过程的.Net Framework项目到.Net Core吗?有没有一种方法可以做到这一点?
是否可以在开发时不必切换到实体框架模式来完成?
我希望保持我们调用存储过程的方式就可以了。
谢谢。

英文:

I was worndering... Should I upgrade a project .Net Framework that's primary based on ADO.Net with lots of procedures to .Net Core? Is there even a way to do it?
Is there a way to do it without having to go into entity framework mode when developing.
I want it to stay with the way we call proc and that's it.
Thanks.

答案1

得分: 1

你可以,也应该这样做。Core 包含许多新的出色功能,包括一些显著的性能提升。虽然尚未正式宣布,但明确的意图是 Core 是未来,Framework 是过去;可能会有一天 Framework 不再受支持,你迟早需要进行迁移。你越早进行过渡,就越不用担心在两个平台之间的“漂移”,迁移也会更容易。

对于 ADO.Net,具体来说,主要的技巧是提供程序已经移动。虽然它们仍然可用,但命名空间不同(例如:Microsoft.Data.SqlClient 而不是 System.Data.SqlClient),它们不包含在默认安装中,而必须从 NuGet 中添加。除此之外,其他 ADO.Net 代码应该继续像以前一样工作。

但要注意,从 Framework 到 Core 的迁移中,你可能还会发现其他非 ADO.Net 的东西也已经移动或更改(例如:WinForms、安全/加密 API 和身份验证等),因此这仍然可能是一项重大工程。

英文:

You can and should do this. There are a lot of nice new features included as part of Core, including some significant performance wins, and while it hasn't been formally announced yet the intent is clear Core is the future and Framework is the past; there will likely come a day when Framework is no longer supported and you will need to do this at some point anyway. The sooner you make the transition, the less "drift" you'll have to worry about between the two platforms and the easier the migration will be.

For ADO.Net, specifically, the main trick is the providers have moved. While they are still available, the namespace is different (ie: Microsoft.Data.SqlClient instead of System.Data.SqlClient) and they are not included out of the box but must instead by added from NuGet. Aside from this fairly simple change other ADO.Net code should continue to work as before.

Beware, though, you might also find a few other non-ADO.Net things have also moved or changed in the transition from Framework to Core (WinForms, Security/Cryptogaphry APIs, and identity come to mind just at the beginning), so this can still be a significant undertaking.

huangapple
  • 本文由 发表于 2023年7月6日 13:40:06
  • 转载请务必保留本文链接:https://go.coder-hub.com/76625805.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定