Visual Studio 2013, Firebird and Entity Framework - visual-studio

I still cannot use EF with Firebird in VS2013 pro and Win7 pro !
Here's what I have done :
I have created a new class library for my dal project, and imported the ef6 and the firebird provider via nuget like said in this page http://www.nuget.org/packages/FirebirdSql.Data.FirebirdClient-EF6/
Then I copied the fb provider to some place and use gacutil to register it into the cache:
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\gacutil -i fibirdprovierpath
Please note that I used the gacutil from the netfx4.5.1 (don't know if it change something)
After that I grabbed the ddex dlls, put them somewhere, change the regfiles that came with (32/64), for the path and ran them.
I have also modified the machine.config (32/64) to reference the Firebird provider .
Now, I can add a Firebird connection without any problem in the servers window, I can even create a Winforms pp that uses a Firebird dataset, BUT when I want to add an .edmx model, the Firebird option is unavailable, I have only SQL Server.
Make sense to anyone please !!!

Is this not related to your problem? http://tracker.firebirdsql.org/browse/DNET-522

i finally fugured out how to fix that !
with the registry files there is another subfolder named withSDK and it was empty,
so i searched for an older ddex files , edited the registry files that are located in that withsdk folder and voila !

Related

What is the ProviderManifestToken value for Oracle.ManagedDataAccess 19.3?

Just installed ODAC for Visual Studio 2017 version 19.3 from here: https://www.oracle.com/database/technologies/dotnet-odacmsi-vs2017-downloads.html to replace ODT for Visual Studio 2017 NuGet Package. Then I noticed my Oracle NuGet packages were gone in my VS solution, and I had to re-add them. But this time I used Oracle.ManagedDataAccess 19.3 (previously had used 12.2.1100), and Oracle.ManagedDataAccess.EntityFramework 19.3 (previously used 12.2.1100).
Now my EDMX gets an error when I try to open it: "Error 168: The provider did not return a ProviderManifest instance. The type initializer for 'OracleInternal.Common.ProviderConfig' threw an exception."
I found an interesting answer by Mitaka here: Entity Framework: The provider did not return a providermanifest instance, so I opened my EDMX with XML Text Editor and found my ProviderManifestToken="12.1". So just for grins, I tried "19.3" and "19.1" but neither worked.
Anybody know the magic value? I'm just hoping that is how to solve the error. Thanks.
Got it. "18.0"
It actually updated itself after I got a bunch of other kinks worked out including "There is a duplicate 'oracle.manageddataaccess.client' section defined." Turns out the definition for Oracle.ManagedDataAccess was in my WebAPI web.config and also the machine config. Had to update THIS specific machine.config:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config - do a search on "managed" and comment out in 3 places.
Then it let me create a connection in Visual Studio 2017 Server Explorer and open the EDMX. Finally the EDMX update wizard is no longer aborting on the Data Connection screen. Back in business.

Oracle Entity Data Model(ODP.NET)

We are trying to create an Entity Data model (edmx) file using Database first approach for Oracle Db.( We already have a running version of edmx for SQL Server).
Installed ODP.NET package which includes Oracle.ManagedDataAccess.dll and Oracle.ManagedDataAccess.EntityFramework.dll in Visual studio 2017 for Framework 4.5 via Nuget Packages
Manually modified the connection string for Oracle as
<connectionStrings>
<add name="FacetsDataModel"
connectionString="metadata=res://*/EntityDataModel.csdl|res://*/EntityDataModel.ssdl|res://*/EntityDataModel.msl;provider=System.Data.OracleClient;provider connection string=”Data Source=***;User Id=**;Password=***;”;" providerName="Oracle.ManagedDataAccess.Client" />
</connectionStrings>
The above approach didn't work because we found out that we are missing ODP.Net Managed Provider in the system. So we tried installing ODT Tools for Visual Studio 2013(didn’t work) uninstalled the same and installed 2017(still the same issue)
We found out that we missed ODAC (Oracle Data Access Components), so we installed the same but still, we didn't get the ODP.Net Managed Data Provider.
We checked the machine.config file from the below path: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config
When we tried searching for a solution, we got the below link ODP.NET Managed - Unable to find requested.Net Framework Data Provider
Point 11 -- They have mentioned modifying the machine.config file by including ODP.NET, Managed Driver Under section. After modifying the machine.config file, our visual studio got crashed.
As mentioned in the link, we checked with Registry key file and check if RegKey exists or not.
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft.NETFramework\v4.0.30319\AssemblyFoldersEx\odp.net.managed
A managed ODP.NET driver does not show up in Data Source dialogue
But in our system, there is no such folder exists named AssemblyFoldersEx in the specified path.
You missed several information, for example what is in your config file machine.config. Also you did not provide us any error message. Statements as "The above approach didn't work" are not very helpful.
Anyway I will try to give you some hints:
ODAC (Oracle Data Access Components) is a collection of various providers (ODP.NET managed and unmanaged, ODBC, OLE DB). Perhaps you selected the wrong component while installation.
HKLM\SOFTWARE\Wow6432Node\Microsoft.NETFramework\v4.0.30319\AssemblyFoldersEx\odp.net.managed is not used anymore. Usually the installation script should have deleted it. You Registry should look like this:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx\ODP.Net]
#="c:\\oracle\\product\\12.2\\odp.net\\bin\\2.x"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\ODP.Net]
#="c:\\oracle\\product\\12.2\\odp.net\\bin\\4"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\Oracle.ManagedDataAccess]
#="c:\\oracle\\product\\12.2\\odp.net\\managed\\common"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\Oracle.ManagedDataAccess.EntityFramework6]
#="c:\\oracle\\product\\12.2\\odp.net\\managed\\common\\EF6"
Of course you have to set folders according to your system.

Oracle data provider for .NET has been installed without machine-wide configuration

I reinstalled ODAC Oracle but keep getting following error
"Oracle Data Provider for .NET has been installed without a machine-wide configuration. However, a version of Oracle Data Provider for .NET has been detected in the Global Assembly Cache which may be incompatible. Please remove Oracle Data Provider for .Net from Global Assembly Cache an restart Visual Studio"
Should I care about this warning?
I did a lot of stuff which didn't helped.
But one thing did.:
open visual Studio Command prompt in admin mode
https://learn.microsoft.com/en-us/dotnet/framework/tools/developer-command-prompt-for-vs
there you have to use gacutil /l to list all assemblies
https://learn.microsoft.com/en-us/dotnet/framework/tools/gacutil-exe-gac-tool
Then delete every entry which includes oracle:
gacutil /u [assembly name]
you can get the assembly name out of the list before. Just use the term before the first comma (e.g. Oracle.ManagedDataAccess)
After that I opened Visual Studio and the error message disappeared.
What happened was, that in the machine.config were entries which I needed to delete. Which one you have to delete shows the error while you debugg the code.
Hope it will help.

Missing "Ado.Net Entity Data Model" on Visual Studio 2013

I have created new web project but I can't find ADO.net Entity DAta Model to add it.
How to fix it or Install it ?
Go to "C:\ProgramData\Package Cache" and search for "EFTools.msi".
You should find two files, just install the most recent one (it should be about 960KB). This fixed the problem for me.
i have the same problem, but there is no "EFTools.msi" in "C:\ProgramData\Package Cache" for me...
UPDATE :
i download and install "Entity Framework 6 Tools for Visual Studio 2012 & 2013" and it solved the problem \m/
Download Link
Some web tutorials show a 'ADO.NET data entity model' item in the 'Models->Add' menu. In VS2015 this menu item is not shown. You need to keep drilling down by selecting 'New Item...' and then further selecting 'Data' from the pop-up dialog.
My solution was none like the above.
The .msi file was nowhere in the folders suggested in prior answers, nor doing a search in my hard drive found any EFTools.msi instances.
So the failsafe approach came through this article (since the author appears to have completely removed the page from the server, I've changed the URL to a version of the page stored in Google's cache), which was poorly written by a chinese fella, so I'm gonna try to rewrite the steps in a clearer way:
The solution is as follows:
Open your VS2013 installation ISO (or pop the DVD in) and navigate to "\packages\EFTools" folder;
There you will find 2 files (a .cab file and a .msi file);
Copy both files to a directory on your hard drive;
[Optional]: You can create in that same directory, an empty .txt file ("Log.txt") so that the installation log output will be redirected to it later;
Open a MS-DOS command prompt (with administrative rights) and type the command: EFTools.msi USING_EXUIH=1 /log "Log.txt" [NOTE: If you did not perform step #4, then you do not need to type from the ' /log' on (inclusive)]
Wait patiently while the installation process finishes. Takes quite some time (guess never hurts to remind you that this needs to be done with VS2013 closed). The installation should go fine, anything weird will be logged into the text file (the one you created in step #4).
Or, you might just double-click the .msi file if you are feeling brave..
After installation, open VS2013 and try adding a new item to the Models folder. The "ADO.NET Entity Data Model" should have reappeared under the "Data" tab.
Recognition goes to the anonymous chinese poster on that link (er, "Melinda"?) - xiè-xiè!
Be sure you are trying to do that in .Net Framework project. For example, when you are creating a project do not use a template called Windows Forms App (.Net Core), use Windows Forms (.Net Framework). The (.Net Framework) extension is important.
right click on your project--> properties---> framework target select 4.5 and should work.
It's only for Visual Studio 2012. For me this had no effect on 2013.
For the record, if you have Visual Studio 2015 RC, the "EFTools.msi" can't be downloaded from Microsoft
If you accidentally delete the "ProgramData" folder, the Repair option will not work, you have to use the Add or Remove features option from the installer, and check the SQL Server Data Tools
Make sure the type of project you've added is for .NET Framework and not for .NET Standard. The templates for adding things such as ADO.NET Entity Data Model are included for .NET Framework.
For Visual Studio 2017 the following works.
Create project:
Create new project of type 'Class Library'
Install 'Entity Framework' from NuGet
Now add datamodel:
In project click 'Add New Item'
Select 'Visual C# Items' -> 'ADO.NET Entity Data Model'
I recently added Entity Framework and installed in one of my many projects in a single sln file.
The thing is Entity Framework works on Framework higher than 3.5.
So Class Library of NET Standard wouldn't support Entity Framework, thus missing Ado.Net Entity Data Model, Since NET Standard console Library is Framework 2.0, changing the class Library to .NET Framework one, will include Ado.Net Entity Data Model.
I had the same issue, but found out that I was selecting ASP.NET Core web App, ASP.NET Core web App(MVC) etc, Instead Choose ASP.NET Web Application (.NET Framework) and you will get the ADO.NET Entity Data Model option.
Go to visual studio installer.
Add:
Entity framework tool 6
Download and install it.

Using SQL Server CE 4 on a remote host with MVC 3

I just upgraded my host to MVC 3 but I'm trying to do a "hello world" using SQLCE 4.0 but I just got:
Sorry, an error occurred while
processing your request.
I see my layout and everything but instead of data I see that.
On localhost is working as expected
I have:
<add name="PruebaContext" connectionString="Data Source=|DataDirectory|db.sdf" providerName="System.Data.SqlServerCE.4.0"/>
as connectionString.
I put the sdf as part of the project, I added the System.Data.SqlServerCE.dll to the project with the local copy to true.
I have no more ideas. The connString, the dll is in /bin and is working in localhost.
Any ideas?
Thanks.
EDIT
I have some logs now:
Without the "System.Data.SqlServerCE.dll" on /bin:
Unable to find the requested .Net Framework Data Provider. It may not be installed.
System.ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.
Fine enough. They don't have SqlServerCE4.
With the Dll on local copy, AKA /bin:
Unable to load the native components of SQL Server Compact corresponding to the ADO.NET provider of version 8482. Install the correct version of SQL Server Compact. Refer to KB article 974247 for more details.
Exception Details: System.Data.SqlServerCe.SqlCeException: Unable to load the native components of SQL Server Compact corresponding to the ADO.NET provider of version 8482. Install the correct version of SQL Server Compact. Refer to KB article 974247 for more details.
The KB says that I need the dll from x86 and amd64. I read somewhere that if I copy two directories to /bin, like: /bin/x86 and /bin/amd64 . I copied that folders from the private folder of SqlServerCE 4 installation folder. Now I got:
Possible file version mismatch detected between ADO.NET Provider and native binaries of SQL Server Compact which could result in an incorrect functionality. This could be due to the presence of multiple instances of SQL Server Compact of different versions or due to wrong binaries with same name as SQL Server Compact binaries. Please install SQL Server Compact binaries of matching version.
Ok. On the root folder of SQLServerCE4 I have some dlls too, so I deleted that two folders and copied that dll to /bin:
Could not load file or assembly 'file:///C:\HostingSpaces\jesusrod\foxandxss.net\wwwroot\mvc3\bin\sqlceca40.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
I think that I tried all things. Scottgu said that SqlServerCE 4 should work on any server without installation.
I don't like to respond to my own answer, but after hours of work I have the answer!
We need:
NuGet (Better than copying the dll's from program file)
With NuGet we install:
EFCodeFirst
SqlServerCompact
EFCodeFirst.SqlServerCompact
The problem was that EF need another dll for SQL CE 4 (System.Data.SqlServerCe.Entity.dll) and we need to put some configuration on web.config:
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.4.0" />
<add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
</DbProviderFactories>
</system.data>
With that, all is working. I have seen like 5 different errors, so we need:
The 2 dll from SQL CE 4, the EF dll, the config in web.config and the native dll (from the package directory where NuGet downloads the library).
It seems that the web.config config is pointing to a concrete version of the SQL CE .dll and the version of the RTM package is different. I can't find the concrete version so I use the .dll from NuGet.
That's all, SQL CE 4 + EF on a remote host.
Just use menu "Project/Add Deployable Dependencies..."
I'm not sure if it is Visual Studio 2010 SP 1 only.
You need to make sure you have the native SQL CE 4.0 dlls in your private application directory (e.g. \bin) in addition to the managed one.
Copy them from "C:\Program Files (x86)\Microsoft SQL Server Compact Edition\v4.0\Private\amd64" (or x86 if you have a 32-bit app).
It may also be wise to deploy the MSVCR90.dll and it's manifest too. Have a look at the documentation in C:\Program Files (x86)\Microsoft SQL Server Compact Edition\v4.0
for more information about the required DLLs and redistribution.
This looks like a problem that's caused by having multiple intermediate bits of data left in a project, where you've replaced included files without cleaning up.
I'd recommend doing a Build->Clean all, followed by making sure that all of your references are to the new, correct DLLs, and then making sure that none of the old files or references are still around anywhere in your project. Attempt to rebuild once that is done.
Since this is a hello world project, it might be easier to just start from scratch with a new project, and include the correct dlls in there.
try installing SQL CE manually.
http://www.microsoft.com/download/en/details.aspx?id=17876
Good Luck.
I was having the same problem. Trying to put a code-first SQL CE 4.0 app into play on my goDaddy account.
I started messing around with various DLL files based upon the thread above and other tutorials, but nothing seemed to work. Something was missing. Then I read about the Add Deployable Dependencies response.
I did that, which created _bin_deployableAssemblies folder. Then I deleted everything from my bin folder except my core project's DLL and copied everything from _bin_deployableAssemblies into the bin folder.
I cleaned out everything in the bin folder on my goDaddy app and resynced the files. That worked. The app loads and if I make codefirst changes to the classes, the dbcontext recreates the database for me. Of course, I don't want that in production, but I wanted to know that everything was working.
I did try using the ASP tutorial about deploying an MVC app to a hosting environment (they use Cytanium hosting as their example), but it didn't work for me on GoDaddy. I had to copy files manually.
Thanks all. This was a huge step for me being able to feel comfortable continuing in MVC and EF.

Resources