Oracle Database and SQL Server with the same schema in a single Entity Framework

I have a task in my existing application that we have two different databases, one in SQL Server and one in Oracle, but both schemas are the same.

We currently have an ASP.NET MVC application using Entity Framework and SQL Server. Can I use the same entity model for Oracle database without changing the code? Since some data types in Oracle and SQL Server are completely different, so the normal entity model .edmx

does not work and the code also throws an error. Is there a way to achieve this?

Please give me a hint so I can move on.

+3


source to share


1 answer


I found out that one solution is to use the same amd msl csdl part from the edmx file that you already created via your sql server connection and there are different ssdls for each database type.

If you don't know where they are in your project or how to access them, just right click on the edmx file in your solution browser and select Open and select the xml editor. there you can see that each part has this name in the comments section

enter image description here

Also, there is a Microsoft EdmGen.exe tool that is part of the .net framework (so no need to download it, you have)



Tool info: https://msdn.microsoft.com/en-us/library/bb896270(v=vs.110).aspx

With this tool, you can convert ssdl file to oracle equivalent.

Due to the fact that I also work during this period, I do not have a complete answer, but it may give you a start.

+1


source







All Articles