The ADO.NET provider with invariant name 'Devart.Data.Salesforce'

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
tbconrad
Posts: 11
Joined: Tue 17 Apr 2018 01:32

The ADO.NET provider with invariant name 'Devart.Data.Salesforce'

Post by tbconrad » Mon 24 Sep 2018 19:53

Error Details: The ADO.NET provider with invariant name 'Devart.Data.Salesforce' is either not registered in the machine or application config file, or could not be loaded.

I get this error when the application tries to execute in the production environment. I am on the latest release of Sept 20, 2018 and have executed an upgrade on the solution.

The configuration file has the following providers

Code: Select all

  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <providers>
      <provider invariantName="Devart.Data.Salesforce" type="Devart.Data.Salesforce.Entity.SalesforceEntityProviderServices, Devart.Data.Salesforce.Entity.EF6, Version=3.3.597.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
This runs without error in the dev environment.

The dll's in the production environment are of the same version.

Does anyone have any insight into why this is happening and how to fix it?

UPDATE:
Created a simple test project with a single call into the Salesforce context. I executed it from the bin folder on the dev machine and it functioned as expected. I moved it to the production server and it failed with the same error message. Something tells me it's not looking in the bin folder for the dll's but rather the GAC although the settings on the assembly look correct in Visual Studio.

UPDATE:
Target Production System is Windows Server 2012

StackTrace:

Code: Select all

Error Details: The ADO.NET provider with invariant name 'Devart.Data.Salesforce' is either not registered in the machine or application config file, or could not be loaded. See the inner exception for details. Stack:    at System.Data.Entity.Infrastructure.DependencyResolution.DefaultProviderFactoryResolver.<GetService>b__0(ArgumentException e, String n)
   at System.Data.Entity.Infrastructure.DependencyResolution.DefaultProviderFactoryResolver.GetService(Type type, Object key, Func`3 handleFailedLookup)
   at System.Data.Entity.Infrastructure.DependencyResolution.DefaultProviderFactoryResolver.GetService(Type type, Object key)
   at System.Data.Entity.Infrastructure.DependencyResolution.CachingDependencyResolver.<>c__DisplayClass1.<GetService>b__0(Tuple`2 k)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at System.Data.Entity.Infrastructure.DependencyResolution.CachingDependencyResolver.GetService(Type type, Object key)
   at System.Data.Entity.Infrastructure.DependencyResolution.ResolverChain.<>c__DisplayClass3.<GetService>b__0(IDbDependencyResolver r)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at System.Data.Entity.Infrastructure.DependencyResolution.ResolverChain.GetService(Type type, Object key)
   at System.Data.Entity.Infrastructure.DependencyResolution.RootDependencyResolver.GetService(Type type, Object key)
   at System.Data.Entity.Infrastructure.DependencyResolution.ResolverChain.<>c__DisplayClass3.<GetService>b__0(IDbDependencyResolver r)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at System.Data.Entity.Infrastructure.DependencyResolution.ResolverChain.GetService(Type type, Object key)
   at System.Data.Entity.Infrastructure.DependencyResolution.CompositeResolver`2.GetService(Type type, Object key)
   at System.Data.Entity.Infrastructure.DependencyResolution.DbDependencyResolverExtensions.GetService[T](IDbDependencyResolver resolver, Object key)
   at System.Data.Entity.Core.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString)
   at System.Data.Entity.Core.EntityClient.EntityConnection..ctor(String connectionString)
   at System.Data.Entity.Internal.LazyInternalConnection.InitializeFromConnectionStringSetting(ConnectionStringSettings appConfigConnection)
   at System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String name, AppConfig config)
   at System.Data.Entity.Internal.LazyInternalConnection.Initialize()
   at System.Data.Entity.Internal.LazyInternalConnection.CreateObjectContextFromConnectionModel()
   at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
   at System.Data.Entity.Internal.InternalContext.Initialize()
   at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
   at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
   at System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
   at System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider()
   at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source)
Last edited by tbconrad on Tue 25 Sep 2018 15:35, edited 1 time in total.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: The ADO.NET provider with invariant name 'Devart.Data.Salesforce'

Post by Shalex » Tue 25 Sep 2018 11:29

tbconrad wrote: Mon 24 Sep 2018 19:53The ADO.NET provider with invariant name 'Devart.Data.Salesforce' is either not registered in the machine or application config file, or could not be loaded.
You should inform your environment about the provider factory existence (add the entry to the DbProviderFactories section):

Code: Select all

<system.data>
  <DbProviderFactories>
    <remove invariant="Devart.Data.Salesforce" />
    <add name="dotConnect for Salesforce" invariant="Devart.Data.Salesforce" description="Devart dotConnect for Salesforce" type="Devart.Data.Salesforce.SalesforceProviderFactory, Devart.Data.Salesforce, Version=3.3.597.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
  </DbProviderFactories>
</system.data>
Refer to https://www.devart.com/dotconnect/sales ... s/?EF.html.

tbconrad
Posts: 11
Joined: Tue 17 Apr 2018 01:32

Re: The ADO.NET provider with invariant name 'Devart.Data.Salesforce'

Post by tbconrad » Tue 25 Sep 2018 15:34

That fix worked in the small test application I wrote to check connectivity to Salesforce but after adding it to the production application that interacts with the EDML now throws this error. I regenerated the edml file using the latest version of Entity Developer with the same results. Any thoughts? Note: This does not occur in Visual Studio only when the app is deployed.

connection string

Code: Select all

    <add name="EFSalesforceContext" connectionString="metadata=res://EFSalesforceContext/EFSalesforceContext.csdl|res://EFSalesforceContext/EFSalesforceContext.ssdl|res://EFSalesforceContext/EFSalesforceContext.msl;provider=Devart.Data.Salesforce;provider connection string=&quot;User Id=USERHERE;Password=PASSWORDHERE;Security Token=TOKENHERE;Persist Security Info=True;Host=salesforce.com;Deferred Login=False;System Objects=True;Refresh Metadata=True&quot;" providerName="System.Data.EntityClient" />
Metadata Artifact Processing is set to "Embed in output Assembly"

Code: Select all

Error Details: Unable to load the specified metadata resource. Stack:    at System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoaderCompositeResource.LoadResources(String assemblyName, String resourceName, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver)
   at System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoaderCompositeResource.CreateResourceLoader(String path, ExtensionCheck extensionCheck, String validExtension, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver)
   at System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoader.Create(String path, ExtensionCheck extensionCheck, String validExtension, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver)
   at System.Data.Entity.Core.Metadata.Edm.MetadataCache.SplitPaths(String paths)
   at System.Data.Entity.Core.Common.Utils.Memoizer`2.<>c__DisplayClass2.<Evaluate>b__0()
   at System.Data.Entity.Core.Common.Utils.Memoizer`2.Result.GetValue()
   at System.Data.Entity.Core.Common.Utils.Memoizer`2.Evaluate(TArg arg)
   at System.Data.Entity.Core.Metadata.Edm.MetadataCache.GetArtifactLoader(DbConnectionOptions effectiveConnectionOptions)
   at System.Data.Entity.Core.Metadata.Edm.MetadataCache.GetMetadataWorkspace(DbConnectionOptions effectiveConnectionOptions)
   at System.Data.Entity.Core.EntityClient.EntityConnection.GetMetadataWorkspace()
   at System.Data.Entity.Core.Objects.ObjectContext.RetrieveMetadataWorkspaceFromConnection()
   at System.Data.Entity.Core.Objects.ObjectContext..ctor(EntityConnection connection, Boolean isConnectionConstructor, ObjectQueryExecutionPlanFactory objectQueryExecutionPlanFactory, Translator translator, ColumnMapFactory columnMapFactory)
   at System.Data.Entity.Internal.InternalConnection.CreateObjectContextFromConnectionModel()
   at System.Data.Entity.Internal.LazyInternalConnection.CreateObjectContextFromConnectionModel()
   at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
   at System.Data.Entity.Internal.InternalContext.Initialize()
   at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
   at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
   at System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
   at System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider()
   at System.Linq.Queryable.Where[TSource](IQueryable`1 source, Expression`1 predicate)
   at BoomerangData.SFGroupRepository.GetUnassignedUserId() in C:\_Development\lhfs repo\App.Boomerang\BoomerangData\Repository\SFGroupRepository.cs:line 20
   at BoomerangData.SalesForceUnitOfWork..ctor(EFSalesforceContext context, Boomerang bContext, Environments environment) in C:\_Development\lhfs repo\App.Boomerang\BoomerangData\UnitOfWork\SalesForceUnitOfWork.cs:line 38
   at BoomerangIntegrationProcessor.SalesForceProcessing..ctor(Environments environment) in C:\_Development\lhfs repo\App.Boomerang\BoomerangIntegrationProcessor\Classes\SalesForceProcessing.cs:line 17
   at BoomerangIntegrationProcessor.Program.Setup() in C:\_Development\lhfs repo\App.Boomerang\BoomerangIntegrationProcessor\Program.cs:line 61
   at BoomerangIntegrationProcessor.Program.Main(String[] args) in C:\_Development\lhfs repo\App.Boomerang\BoomerangIntegrationProcessor\Program.cs:line 36

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: The ADO.NET provider with invariant name 'Devart.Data.Salesforce'

Post by Shalex » Wed 26 Sep 2018 13:49

1. Can you successfully deploy your small test application to your production?

2. Select your *.edml in Solution Explorer, press F4 (Properties) and confirm that it has:
* Build Action = DevartEntityDeploy
* Custom Tool = DevartEfGenerator

3. After you successfully build and test your application in a development environment, do you rebuild it somewhere before deploying it to the production?

tbconrad
Posts: 11
Joined: Tue 17 Apr 2018 01:32

Re: The ADO.NET provider with invariant name 'Devart.Data.Salesforce'

Post by tbconrad » Wed 26 Sep 2018 18:14

1. Can you successfully deploy your small test application to your production?
Yes, and it works as expected
2. Select your *.edml in Solution Explorer, press F4 (Properties) and confirm that it has:
* Build Action = DevartEntityDeploy
* Custom Tool = DevartEfGenerator
Yes, these are set on the edml file

3. After you successfully build and test your application in a development environment, do you rebuild it somewhere before deploying it to the production?
No. I build the console application in Visual Studio and then copy the contents of the bin folder to the production deploy folder.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: The ADO.NET provider with invariant name 'Devart.Data.Salesforce'

Post by Shalex » Fri 28 Sep 2018 18:53

1. Compare connection strings of working and failing test projects. For example: does working one have two &quot; entries instead of " signs?

2. Decompile your failing application assembly (for example, with JustDecompile) and make sure that *.csdl, *.ssdl, *.msl resources were actually embedded into it. Compare it with a working assembly.

tbconrad
Posts: 11
Joined: Tue 17 Apr 2018 01:32

Re: The ADO.NET provider with invariant name 'Devart.Data.Salesforce'

Post by tbconrad » Fri 28 Sep 2018 23:30

It was indeed a problem with the connection string. I forgot I was using slow cheetah and config transforms that was why it was working on the dev environment and not in production. The production config had a malformed connection string. That's the second time slow cheetah has bitten me. :) I need to remember I use it. Thanks for the help.

Post Reply