问题
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