This blog and website contain digital business research in the areas of Industry 4.0 and health service delivery.
We examine how business digitization, internetworked digital devices (IoT), real-time streaming analytics, application programming interfaces (APIs), and DevOps can improve business outcomes and the customer experience.
"Naming the new, completely written from scratch ASP.NET framework “ASP.NET 5″ was a bad idea for a one major reasons: 5 > 4.6 makes it seem like ASP.NET 5 is bigger, better, and replaces ASP.NET 4.6. Not so."
I just went through an exercise trying to use code based configuration with Oracle's ODP.NET and although there is a lot of information out there I had to eventually go to the Official API documentation to close the loop.
This is what I had to do - hopefully it will help someone else.
I created a WCF self-hosted console application. All this sample does is take a primary key integer value and return a first and last name from a USERS table in Oracle 11gR2.
First thing - don't do the heavy lifting yourself - use NuGet. Right-click on your project in the Solution Explorer and select "Manage NuGet Packages...".
In the search box enter "odp.net managed".
Select "ODP.NET, Managed Entity Framework Driver - Official" and "Install" it. Note that this screen shows green checkmarks because they are already installed in my case.
It is dependent upon the Entity Framework and "ODP.NET, Managed Driver - Official" so it will automatically include them.
Note that it will include Entity Framework 6.0.0. Use the "Updates" section to update it to the latest version.
After doing this you will have the following installed packages.
Your project will now be configured to use Oracles ODP.NET Managed Entity Framework Driver.
I am going to quickly skip through some details of my simple sample. I added an ADO.NET Entity Data Model for my sample.
And I selected "Code First from Database".
My Oracle database is a single table where ID is also a primary key.
The resulting model artifacts are:
I have a GetData operation as part of my service that takes the ID value and returns the first and last name.
If you run this it will work using the values from the application configuration file.
However, the Entity Framework and DB Providers sections in the configuration file can be replaced by creating a DbConfiguration object with the following settings. The "using" values shown are the ones that I had to add.
Additionally, the Model's DbContext must be annotated to use this DbConfiguration. (Note that there are other options for associating the DbConfiguration with the DbContext that I am not covering here.)
You can now remove the following sections from your app.config file and it should still work.