Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
victoryismine06
Posts: 4
Joined: Tue 20 Sep 2011 15:51
Location: United States

Hi,

So long story short, we have Devart and EF working well locally on all our developers boxes. However we use TFS to deploy the project to our IIS servers and all that goodness. I've been fighting with this thing for a couple days now so I'm ready to ask for help...

I can't seem to get around a MetadataException: Unable to load the specified metadata resource. I took this to mean there is most likely an issue with my connection string (I've tried changing it many different way, but still no luck). But I'm also curious if I get to this point, has dotconnect for Oracle had any role in execution yet? I'm trying to verify I have dotconnect correctly installed on our server. Any suggestions?

Shalex
Posts: 8245
Joined: Thu 14 Aug 2008 12:44
"MetadataException: Unable to load the specified metadata resource." is a message of Entity Framework run-time, which tries to find and load metadata that is mentioned in connection string. The dotConnect for Oracle code is not used yet.

http://www.devart.com/forums/viewtopic.php?t=14973
http://www.devart.com/forums/viewtopic.php?t=18544

Notify us about the results. Is this a full text of the exception? Are there any details?

victoryismine06
Posts: 4
Joined: Tue 20 Sep 2011 15:51
Location: United States
Thank you for the suggestions. I'll look through them and let you know.

victoryismine06
Posts: 4
Joined: Tue 20 Sep 2011 15:51
Location: United States
No idea why, but apparently there was something causing the "DevartEntityDeploy" Build Action to not include the models as resources. I changed it to "EntityDeploy" then back and it started working. So thank you very much for the articles, they pointed me in the right direction!

Now I'm finally getting Devart exceptions, I'm actually excited! Anyways, I've been trying to follow these resources to determine what is needed for deployment but I'm still a bit confused.

http://www.devart.com/dotconnect/oracle ... yment.html
http://www.devart.com/forums/viewtopic.php?t=21654

On the IIS server, the application has Full Trust, we also have a minimal install of dotconnect for oracle express.

I get the same Exception Message: "System.Data.ProviderIncompatibleException: A null was returned after calling the 'GetService' method on a store provider instance of type 'Devart.Data.Oracle.OracleProviderFactory'. The store provider might not be functioning correctly," as referenced in the second link.

Since all of our developer boxes have a licensed pro version of dotconnect for oracle. I uninstalled the express version and tried to copy my local devart dll's into the IIS project's root\bin directory but then I get a license exception: "License not valid due to the problems with dotConnect for Oracle installation".

After digging around a little i found a licenses.licx file containing:

Code: Select all

Devart.Data.Oracle.OracleConnection, Devart.Data.Oracle, Version=6.30.196.0, Culture=neutral, PublicKeyToken=09af7300eec23701
Then I noticed the version of the dlls from my local machine are Version=6.30.202.0 Professional.

Could this file be causing me problems?

Does Professional versus Express edition have an impact?

Its my understanding I only need these three dlls deployed with the website?:
Devart.Data.dll
Devar.Data.Oracle.dll
Devart.Data.Oracle.Entity.dll

This is what I have in my web.config:

Code: Select all




I also tried removing all Devart dlls within the website, and installing the latest dot connect 6.5 Professional trial (Full install, just to see if I can at least to get it to work), but I still get the license exception so I'm slightly confused at what I need to do?

Edit/Update:

I looked through a few more threads in the forum. So I uninstalled devart dotconnect for oracle again. I don't see a Registry key in localMachine/software/... I see a few policy keys however, not sure if I need to delete those. I put the three devart assemblies back in the applications \bin folder but I'm still getting the dang license exception.

Let me know if I should start a new thread instead of using this one.

Shalex
Posts: 8245
Joined: Thu 14 Aug 2008 12:44
victoryismine06 wrote:No idea why, but apparently there was something causing the "DevartEntityDeploy" Build Action to not include the models as resources. I changed it to "EntityDeploy" then back and it started working.
To make the "DevartEntityDeploy" Build Action to work, make sure that:
1. The Copy To Output Directory property of your model is set to "Do not copy".
2. Devart.Data.Entity.Build.Tasks.dll and Devart.Data.Entity.targets are available in the %ProgramFiles%\MSBuild\Devart\v3.5\ folder
3. The %ProgramFiles%\MSBuild\v3.5\Custom.After.Microsoft.Common.targets and %ProgramFiles%\MSBuild\v4.0\Custom.After.Microsoft.Common.targets files have the following entry:

Code: Select all



4. Devart.Data.Entity.Build.Tasks.dll is loaded to the process when you are getting the problem with "DevartEntityDeploy". You can use, for example, FileMon or Process Monitor for this.
victoryismine06 wrote:I get the same Exception Message: "System.Data.ProviderIncompatibleException: A null was returned after calling the 'GetService' method on a store provider instance of type > 'Devart.Data.Oracle.OracleProviderFactory'. The store provider might not be functioning correctly,"
We are aware of one situation when this error occurs if you are using June 2011 CTP:
* EF 4.0 uses System.Data.Entity.dll (v4.0),
* EF 4.1 - System.Data.Entity.dll (v4.0) + EntityFramework.dll,
* June 2011 CTP is a new version of the System.Data.Entity.dll assembly (v4.2), which includes all types, which are defined in two mentioned assemblies, and the new types.

Our EF-provider is compiled with EF 4.0 (System.Data.Entity.dll v 4.0). The June 2011 CTP installer places System.Data.Entity.dll (v4.2)
\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Data.Entity\v4.0_4.2.0.0__b77a5c561934e089\to GAC with its policy file
\Windows\Microsoft.NET\assembly\GAC_MSIL\policy.4.0.system.data.entity\which makes binding redirect (4.0 -> 4.2).

As a result, only System.Data.Entity.dll v4.2 is loaded to the process of application when there is the policy file (by default), and all is fine: and EF run-time and our provider use the same types.

Here is a description of the situation when a NULL can be returned after calling the 'GetService' method.
If there is no mentioned policy file in GAC, both versions (4.0 and 4.2) of System.Data.Entity.dll are loaded to the process. Thus, our provider uses types from System.Data.Entity.dll v4.0, but EF run-time - from the 4.2 version of this assembly. GetService() from our assembly returns instance of the DbProviderServices class from v4.0 successfully, but EF 4.2 receives NULL when tries to cast this type to the DbProviderServices class that is defined in v4.2.

Alternative solutions for this case:
1. Set binding redirect for System.Data.Entity.dll (4.0 -> 4.2) in the *.config file of your application: http://msdn.microsoft.com/en-us/library ... 00%29.aspx .
2. Place the missing policy file (we can sent it to you) in GAC v4.0 (%Windows%\Microsoft.NET\assembly\GAC_MSIL) of your workstation.
victoryismine06 wrote:"License not valid due to the problems with dotConnect for Oracle installation".
Our license resource is version and edition dependent. If you build your application with dotConnect for Oracle v 6.30.202 Professional Trial:
- the licenses.licx file has to contain the 6.30.202 version
- you have to deploy your application with the assemblies (Devart.Data.dll, Devart.Data.Oracle.dll, Devart.Data.Oracle.Entity.dll) from dotConnect for Oracle v 6.30.202 Professional Trial.
victoryismine06 wrote:I see a few policy keys however, not sure if I need to delete those.
Remove all policy.*.Devart.* files from GAC after uninstalling the previous version of dotConnect for Oracle (before installing the new one).

victoryismine06
Posts: 4
Joined: Tue 20 Sep 2011 15:51
Location: United States
Shalex!!! You deserve a raise, or at least a cookie perhaps...

Not sure if I would have ever figured out what I needed to do without your help. I followed your first 4 steps to get devart on our build server and it all works! I don't even have to install anything on our IIS servers or for that matter on our build server either, just copy those files over and have the required dlls in the project.

Thanks again Shalex!