EF Core: Use Linked Server to Oracle database issue

允我心安 提交于 2019-12-25 00:06:08

问题


In another question, I need to use ASPNET BoilerPlate (EF Core template) with the Oracle database but it does not support so far. So I tried to use SQL Server with Linked Server to Oracle database.

What I have tried:

  • Create Linked Server named "LinkedOracle" from SqlServer to Oracle database
  • Create a SqlServer database named "FakeOracleDb" and create Views to LinkedOracle tables by:

    CREATE VIEW CUSTOMER AS SELECT * FROM LinkedOracle..MYUSER.CUSTOMER

  • Now I have a fake SQL Server database that mapped from my Oracle Database (1 View = 1 table in Oracle). I also can select, update,.. in this View. My Customer entity is mapped to this View

  • Change connection string to FakeOracleDb, the data is loaded ok, but when I tried to update the value, I faced the error as below:

Cannot start a transaction for OLE DB provider "OraOLEDB.Oracle" for linked server "LinkedOracle"

Could anyone gives me some advice, please

Update 1:

I have tried to open a transaction and run the update statement in SSMS. It worked after I run SET XACT_ABORT ON, so how can I set this value in EF?

来源:https://stackoverflow.com/questions/54840797/ef-core-use-linked-server-to-oracle-database-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!