是否可以将 LINQ to SQL 与 Oracle 一起使用?
我需要开发一个必须在 Oracle 数据库中删除和插入数据的程序。是否可以将 LINQ to SQL 与 Oracle 一起使用?
对于开发,我使用 MS SQL 服务器,但在生产中它将是 Oracle 数据库。你有什么建议吗?
I need to develop a program that must delete and insert data into an Oracle database. Is it possible to use LINQ to SQL with Oracle?
For development I use MS SQL server but it will be a Oracle database in production. What do you recommend?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
官方说法不是。Linq to SQL 最初构建时能够交换数据提供程序以允许连接到其他数据库,但他们在发布的版本中禁用了此功能,以鼓励人们使用更稳定和受支持的数据访问层(例如 EF) 。如果您想在 SQL 和 Oracle 之间切换,建议的方法是使用实体框架。
另外,帕特里克是非常正确的,请确保您正在针对将在生产中使用的相同数据库平台进行开发和测试,它们的操作方式存在天壤之别。当然,您应该能够将其抽象出来,而不关心您使用的是 SQL 还是 Oracle,但实际情况几乎从未如此。
Officially No. Linq to SQL was originally build with the ability to swap out the data provider to allow connections to other databases, but they disabled this functionality in the released versions to encourage people to use more stable and supported data access layers (like EF). The recommended approach is to use Entity Framework if you want to switch between SQL and Oracle.
Also, Patrick is very right, make sure you are developing and testing against the same database platform you are going to use in production, there is a world of difference in how they operate. Sure, you should be able to abstract it away to not care about whether you are using SQL or Oracle, but that is almost never really the case.
不,你不能。尽管 LINQ to SQL 最初设计时考虑到使用提供程序模型的多数据库支持(您可以在使用 .NET Reflector 查看代码时看到这一点),但该模型从未公开,并且 Microsoft 无意添加多数据库支持 LINQ to SQL。
如果需要多数据库支持,请使用Entity Framework。
No, you can't. Although LINQ to SQL was initialy designed with multi-database support in mind (you can see this when looking at the code using .NET Reflector) using a provider model, this model was never made public and Microsoft has no intensions in adding multi-database support to LINQ to SQL.
If you need multi-database support, please use Entity Framework.
不,LINQ-to-SQL 不支持 Oracle。在内部,该项目支持多个后端,但这从未进入最终的公开版本。我相信 LINQ-to-Entities 支持其他数据库。
No, LINQ-to-SQL doesn't support Oracle. Internally, the project had support for multiple back-ends, but this never made it into the final public release. I believe LINQ-to-Entities supports other databases.