1 2 Previous Next 21 Replies Latest reply on Nov 16, 2018 4:13 AM by Christian.Shay -Oracle

    Issue with Entity Framework with VS2017

    3687299

      Several weeks ago, I installed the Oracle developer tools for Visual Studio 2017.  Configured the tnsnames.ora file. I then wrote code to access tables using the Oracle managed data provider, no issues. Next used Entity Framework to access tables via “EF Designer from existing database” rather than the alternates e.g. code first as this is simply tinkering at the present time and have years’ experience writing code with EF using SQL-Server. I was able to read/update/insert no problem.

       

      Afterwards at some point (I’m sure it was something I did in the project code or config file) I did a build at got

       

      Error 175: The ADO.NET provider with invariant name 'Oracle.DataAccess.Client' is either not registered in the machine or application config file, or could not be loaded. See the inner exception for details Model1.edmx 8

       

      Seemed prudent to uninstall/install all the Oracle software from the Oracle Developer Tools for Visual Studio. Fired up Visual Studio, received the exact same error message.

       

      I tried the solution here but no different https://www.codeproject.com/Tips/524041/Entity-Framework-ProviderManifestToken-not-valid

       

      In a fresh project, attempted to add a model but the Oracle provider does now show anymore.

       

      I have searched the web and most seem to resolve this issue with an uninstall/install yet this failed for me.

       

      Checked machine.config location C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\

       

      <section name="system.data.oledb" type="System.Data.Common.DbProviderConfigurationHandler, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

      <section name="system.data.oracleclient" type="System.Data.Common.DbProviderConfigurationHandler, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

       

       

      So I’m looking for advice on the above issue. Worst case is I forget about Oracle/EF and go old school with the managed data provider.

        • 1. Re: Issue with Entity Framework with VS2017
          Alex Keh - Product Manager-Oracle

          Did you install ODAC with ODT (i.e. zip file) or did you install ODT for Visual Studio (i.e. exe file)? The former includes unmanaged ODP.NET; the latter does not. If it's the latter, that would be the reason you run into this issue.

           

          You can download the zip file with unmanaged ODP.NET (Oracle.DataAccess) here: ODAC Downloads - Oracle Universal Installer

          • 2. Re: Issue with Entity Framework with VS2017
            3687299

            Hello,

            I installed ODAC for Visual Studio 2017, is the correct (as it worked for sometime as mentioned in my initial post).

             

            Oracle Developer Tools for Visual Studio 2017 MSI Installer

            • 3. Re: Issue with Entity Framework with VS2017
              3687299

              Any other thoughts on remedying this issue?

              • 4. Re: Issue with Entity Framework with VS2017
                Alex Keh - Product Manager-Oracle

                Let's step back. Are you trying to use the managed or unmanaged ODP.NET driver now? Your error indicates you are using unmanaged ODP.NET driver (Oracle.DataAccess.Client). If that is not your intention, then you need to modify your EF app to use managed ODP.NET (Oracle.ManagedDataAccess.Client) instead.

                 

                Error 175: The ADO.NET provider with invariant name 'Oracle.DataAccess.Client' is either not registered in the machine or application config file, or could not be loaded. See the inner exception for details Model1.edmx 8

                • 5. Re: Issue with Entity Framework with VS2017
                  3687299

                  Hello,

                   

                  Thanks for getting back to me,

                   

                  I'm solely using Entity Framework, no managed data provider for Oracle.

                   

                  These are my references for the project ..

                  F1.png

                  From what I've learned (at least in this project) Oracle.ManagedDataAccess is required for Oracle.ManagedDataAccess.EntityFramework

                   

                  Thought I'd include the build errors

                  F2.png

                  • 6. Re: Issue with Entity Framework with VS2017
                    3687299

                    Okay I believe it's time to give up.

                     

                    I uninstalled ODAC For Visual Studio 2017, attempted to install the setup in the zip file you mentioned earlier and on my Windows 10 box it will not run. Seems prudent to simply go back to the Oracle managed data provider.

                     

                    Never had any issues with SQL-Server using Entity Framework in small to extremely large enterprise solutions.

                    • 7. Re: Issue with Entity Framework with VS2017
                      Alex Keh - Product Manager-Oracle

                      With respect to EF functionality, managed ODP.NET will provide the same functionality as unmanaged ODP.NET. Since managed ODP.NET is easier to configure and setup, being 100% managed without any any unmanaged assembly dependencies, most customers go with managed in the EF use case.

                      • 8. Re: Issue with Entity Framework with VS2017
                        3687299

                        Hi Alex,

                         

                        For the record, I went and rewrote my Entity Framework code using the managed data provider e.g.

                         

                        public bool UpdateOcsRecord(OcsMessage pRecord, bool pShowCommandText = false)

                        {

                            bool success = false;

                         

                            var updateStatement = @"
                                UPDATE OCS_MESSAGES SET
                                    OCS_MESSAGE_TXT =    :MessageText,
                                    OCS_LANG_CODE =      :LanguageCode,
                                    OCS_FORM_FIELD_NAME  :FormFieldName,
                                    OCS_FORM_FIELD_ORDER :FormFieldOrder
                                WHERE ID = :Identifier"
                        ;

                         

                            using (OracleConnection cn = new OracleConnection() { ConnectionString = ConnectionString })

                            {

                                using (OracleCommand cmd = new OracleCommand() { Connection = cn })

                                {

                                    try

                                    {

                                        cmd.BindByName = true;

                                        cmd.CommandText = updateStatement;

                         

                                        cmd.Parameters.Add(":MessageText", pRecord.MessageText);

                                        cmd.Parameters[":MessageText"].Size = 2000;

                         

                                        cmd.Parameters.Add(":LanguageCode", pRecord.LanguageCode);

                                        cmd.Parameters.Add(":FormFieldName", pRecord.FormFieldName);

                                        cmd.Parameters.Add(":FormFieldOrder", pRecord.FormFieldOrder);

                                        cmd.Parameters.Add(":Identifier", pRecord.id);

                         

                                        if (pShowCommandText)

                                        {

                                            Console.WriteLine(cmd.ActualCommandText(":"));

                                        }

                         

                                        cn.Open();

                                        cmd.ExecuteNonQuery();

                         

                                        success = true;

                         

                                    }

                                    catch (OracleException oex)

                                    {

                                        mHasException = true;

                                        mLastException = oex;

                                    }

                                    catch (Exception ex)

                                    {

                                        mHasException = true;

                                        mLastException = ex;

                                    }

                                }

                            }

                         

                            return success;

                        }

                         

                        My last shot at Entity Framework got me a bit farther by removing all existing "data connections" in Visual Studio 2017 "Server Explorer". After this I could then change  which I could last month then mysteriously did not show up then did after removal of the data connections for Oracle.

                         

                        F1.png

                         

                        On the next page for setting up a model I received the following error message. (the settings are the same as used for using the code indicated above and did work last month).

                        F2.png

                         

                        In closing the agency I work (Oregon department of employment) for, 99 percent of data storage is in Oracle using Cold Fusion. I was hired last month and have the power to teach C# and the goal was to use Oracle Entity Framework to write services to interact with Cold Fusion, Oracle and a mainframe.

                        • 9. Re: Issue with Entity Framework with VS2017
                          3687299

                          So I guess at this point there is no clear direction/advise to proceed?

                          • 10. Re: Issue with Entity Framework with VS2017
                            Alex Keh - Product Manager-Oracle

                            Moving this thread to the ODT forum as the question is specifically about the tools now,

                            • 11. Re: Issue with Entity Framework with VS2017
                              Christian.Shay -Oracle

                              Sorry for the delay in getting back to you.

                               

                              There is a problem whereby updates to Visual Studio 2017 break the Oracle Developer Tools installation. I want to make sure that is not happening here.

                               

                              Can you please:

                              1) Close all instances of Visual Studio.

                              2) Deinstall ODT and wait to make sure you get a final screen saying the deinstall is done (some versions have a period of time with no window)

                              3) Reinstall the latest ODT for VS 2017.

                               

                              Then try your scenario again and let me know.

                              Thanks!

                              • 12. Re: Issue with Entity Framework with VS2017
                                user5553812

                                Yes, I cannot use EF Database first w/ ODT 12.2.0.1.1 and VS 2017 15.8.3 (latest as of this writing).  The update from database wizard just flashes the dialog where you are supposed to indicate EF 6 and goes away, with nothing added to the solution.  Did full uninstall/reinstall of ODT.  Guess I'm outta luck and need to skip EF w/ Oracle.  Unless and until Oracle, you decide to make your bits work w/ VS 2017 again

                                • 13. Re: Issue with Entity Framework with VS2017
                                  2d73e348-7680-4b2d-bf53-59944f4f4cd9

                                  Sorry to use this work .... but this is so very pathetic, i was about to confirm my client that the architecture of my new project is freeze but this this same thing happened , my VS 2017 got Updated and Database Wizard just flashes and goes off

                                  • 14. Re: Issue with Entity Framework with VS2017
                                    John Greenstreet

                                    I am having that exact problem with VS 2017 and have uninstalled/reinstalled various ODT versions without success. This is after using Oracle Managed Driver and EF 6 since it came out. But all of a sudden it stopped working and nobody else here's been able to get it to work either.

                                    1 2 Previous Next