Thanks for tool - Need this to work with DB2 Version 10.5 et al in Code First mode:
Code First - registering provider in App.config; using registered provider in connection string:
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="Devart.Data.DB2" type="Devart.Data.DB2.Entity.DB2EntityProviderServices,
Devart.Data.DB2.Entity, Version=1.6.191.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
</providers>
</entityFramework>
<appSettings>
<!--Enterprise Database-->
<add key="Enterprise.Database" value="L_DEV05" />
<add key="Enterprise.DatabaseVersion" value="1" />
</appSettings>
<connectionStrings>
<!--Named Database Environments-->
<add name="L_DEV05" connectionString="Server=localhost:50001;Database=L_DEV05;UID=db2admin;PWD=Pass@word;" providerName="Devart.Data.DB2" />
</connectionStrings>
</configuration>
Getting exception:
Test Name: Test_INSTANCE
Test FullName: Oban.Platform.Data.Contexts.DbContextTests.CoreContextTest.Test_INSTANCE
Test Source: d:\TFSC\Development\Platform\Data\Contexts\Tests\DbContextTests\CoreContext.cs : line 26
Test Outcome: Failed
Test Duration: 0:00:00.1997616
Result Message: Initialization method Oban.Platform.Data.Contexts.DbContextTests.CoreContextTest.Init threw exception. System.InvalidOperationException: System.InvalidOperationException: The 'Instance' member of the Entity Framework provider type 'Devart.Data.DB2.Entity.DB2EntityProviderServices, Devart.Data.DB2.Entity, Version=1.6.191.0, Culture=neutral, PublicKeyToken=09af7300eec23701' did not return an object that inherits from 'System.Data.Entity.Core.Common.DbProviderServices'. Entity Framework providers must inherit from this class and the 'Instance' member must return the singleton instance of the provider. This may be because the provider does not support Entity Framework 6 or later; see http://go.microsoft.com/fwlink/?LinkId=260882 for more information..
Result StackTrace:
at System.Data.Entity.Infrastructure.DependencyResolution.ProviderServicesFactory.GetInstance(Type providerType)
at System.Data.Entity.Infrastructure.DependencyResolution.ProviderServicesFactory.GetInstance(String providerTypeName, String providerInvariantName)
at System.Data.Entity.Internal.AppConfig.<.ctor>b__2(ProviderElement e)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at System.Data.Entity.Internal.AppConfig.<.ctor>b__1()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at System.Lazy`1.get_Value()
at System.Data.Entity.Internal.AppConfig.get_DbProviderServices()
at System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.RegisterDbProviderServices()
at System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.GetServiceFactory(Type type, String name)
at System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.<>c__DisplayClass1.<GetService>b__0(Tuple`2 t)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.GetService(Type type, Object key)
at System.Data.Entity.Infrastructure.DependencyResolution.DbDependencyResolverExtensions.GetServiceAsServices(IDbDependencyResolver resolver, Type type, Object key)
at System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.GetServices(Type type, Object key)
at System.Data.Entity.Infrastructure.DependencyResolution.ResolverChain.<>c__DisplayClass6.<GetServices>b__5(IDbDependencyResolver r)
at System.Linq.Enumerable.<SelectManyIterator>d__14`2.MoveNext()
at System.Linq.Enumerable.<ConcatIterator>d__71`1.MoveNext()
at System.Linq.Enumerable.<OfTypeIterator>d__aa`1.MoveNext()
at System.Data.Entity.Utilities.IEnumerableExtensions.Each[T](IEnumerable`1 ts, Action`1 action)
at System.Data.Entity.Infrastructure.DependencyResolution.InternalConfiguration.Lock()
at System.Data.Entity.Infrastructure.DependencyResolution.DbConfigurationManager.<.ctor>b__1()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at System.Lazy`1.get_Value()
at System.Data.Entity.Infrastructure.DependencyResolution.DbConfigurationManager.GetConfiguration()
at System.Data.Entity.DbContext.InitializeLazyInternalContext(IInternalConnection internalConnection, DbCompiledModel model)
at System.Data.Entity.DbContext..ctor(String nameOrConnectionString)
at Oban.Platform.Data.Contexts.CoreContext..ctor(Config config) in d:\TFSC\Development\Platform\Data\Contexts\Source\DBContexts\CoreContext.cs:line 28
at Oban.Platform.Data.Contexts.DbContextTests.CoreContextTest.Init() in d:\TFSC\Development\Platform\Data\Contexts\Tests\DbContextTests\CoreContext.cs:line 21
DB2 and EF6 - throwing exception
-
- Posts: 6
- Joined: Wed 12 Feb 2014 00:43
- Location: Melbourne, Australia
- Contact:
Re: DB2 and EF6 - throwing exception
Please replace
with
in your App.config and try again.
Code: Select all
Devart.Data.DB2.Entity, Version=1.6.191.0
Code: Select all
Devart.Data.DB2.Entity, Version=1.6.191.6
-
- Posts: 6
- Joined: Wed 12 Feb 2014 00:43
- Location: Melbourne, Australia
- Contact:
Re: DB2 and EF6 - throwing exception
GR8 Thx
Fixed issue - thx for prompt response
How do I locate correct Build - I used GACUTIL - but a large listing there and many versions.
djt
Fixed issue - thx for prompt response
How do I locate correct Build - I used GACUTIL - but a large listing there and many versions.
djt
Re: DB2 and EF6 - throwing exception
Please add the references to the following assemblies in your project:
\Program Files (x86)\Devart\dotConnect\DB2\Devart.Data.dll
\Program Files (x86)\Devart\dotConnect\DB2\Devart.Data.DB2.dll
\Program Files (x86)\Devart\dotConnect\DB2\Entity\EF6\Devart.Data.DB2.Entity.dll
Does it work?
\Program Files (x86)\Devart\dotConnect\DB2\Devart.Data.dll
\Program Files (x86)\Devart\dotConnect\DB2\Devart.Data.DB2.dll
\Program Files (x86)\Devart\dotConnect\DB2\Entity\EF6\Devart.Data.DB2.Entity.dll
Does it work?