Not working with EF6a3

Mar 5, 2013 at 8:13 PM
Edited Mar 5, 2013 at 8:14 PM
Trying to do:
var ctx = new MyContext(Effort.DbConnectionFactory.CreateTransient());
It seems to work but when it tries to access any DbSet objects, I get the exception:
System.InvalidOperationException : No Entity Framework provider found for 'EffortProvider' ADO.NET provider. Make sure the provider is registered in the 'entityFramework' section of the application config file. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.
Anyone know how to fix this?
Coordinator
Mar 5, 2013 at 9:05 PM
Edited Mar 5, 2013 at 9:06 PM
Hello,

It is not working because Effort currently does not support EF6. There are some significant changes in EF6 (provider model, namespaces, internals) that require to compile the Effort library directly against EF6. Since EF is only in alpha stage, I have not taken this issue on high priority yet. I will prioritize this if you are interested.
Mar 6, 2013 at 1:44 PM
It would be great if it worked. The temporary hack I have is to use LocalDb but that's surprisingly slow in my unit test. I was going to post on the EF discussions to see if anyone has any other suggestions.
Coordinator
Mar 19, 2013 at 10:44 PM
Edited Mar 19, 2013 at 10:45 PM
Okey, now you can download the latest version of the source code and compile yourself:
  • Go to \Main\Build
  • Run Build.cmd
  • Open \Main\Build\Packages\Library.zip
  • Search for the library that is suitable for you
Reference Effort.dll and NMemory.dll in your project and add the following markup to your app.config:
<entityFramework>
   <providers>
      <provider invariantName="EffortProvider" type="Effort.Provider.EffortProviderServices, Effort" />
   </providers>
</entityFramework>
Unfortunately I haven't been able to run my unit tests yet on the EF6 version because of 3rd party compatibility issues, so I do not know how stable this release is.
May 13, 2014 at 11:58 AM
Hello,

I experience the same error message, but I am not able to fix this with your mentioned solution. I am using the latest Effort.EF6 and Entity Framework 6.1.0 in an additional project with NUnit tests. I recieve the above error if I run the first test case which actually tries to access data in the data base.

I've tried using EF 6.0.0-beta like you did in your example code where you ignore the SQL column types since I needed that as well. Now I've added your above statement in the App.config of the NUnit Project, but that does not seem to work.

Do you have any other ideas what could be the problem, because I am pretty clueless at the moment.

Thanks for your time and effort that you put in those projects!

Best regards
Coordinator
May 26, 2014 at 8:42 AM
Hello,

Sorry for the late response. Calling the following method before any db operation should work:
Effort.Provider.EffortProviderConfiguration.RegisterProvider();
See: Effort test project

May I ask you to send me a little proof of concept project in the case you do not manage to fix the problem with this approach?

Cheers,
Tamas
May 27, 2014 at 3:52 PM
Edited May 27, 2014 at 3:52 PM
Hi Tamas,

Thanks for your response. I've already added the above code before in a [SetUpFixture] class (I am using NUnit) and I've additionally checked now that it is really called. I've used your test project (and modified it) with the same component setup (Core (POCOs), DataAccessLayer and a DataAccessLayerTest as I am using in my project), but I am not able to reproduce it in any way.

The only thing that I found out was, that if I add
<provider invariantName="Effort.Provider" type="Effort.Provider.EffortProviderServices" />
explicity it fails in the test project with:
Result Message: Unable to create instance of class EffortTest.CatTests. Error: System.InvalidOperationException: The Entity Framework provider type 'Effort.Provider.EffortProviderServices' registered in the application config file for the ADO.NET provider with invariant name 'Effort.Provider' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information..
So probably something is wrong with this string.

I've added now the full stack trace of the error I get in my main project, maybe you have an idea.
Result Message: System.InvalidOperationException : No Entity Framework provider found for the ADO.NET provider with invariant name 'Effort.Provider'. Make sure the provider is registered in the 'entityFramework' section of the application config file. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.
Result StackTrace:  
at System.Data.Entity.Infrastructure.DependencyResolution.DefaultProviderServicesResolver.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.Utilities.DbProviderFactoryExtensions.GetProviderServices(DbProviderFactory factory)
at System.Data.Entity.Infrastructure.DefaultManifestTokenResolver.<>c__DisplayClass1.<ResolveManifestToken>b__0(Tuple`3 k)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at System.Data.Entity.Infrastructure.DefaultManifestTokenResolver.ResolveManifestToken(DbConnection connection)
at System.Data.Entity.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, DbProviderManifest& providerManifest)
at System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection)
at System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)
at System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input)
at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
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.Internal.Linq.InternalSet`1.ActOnSet(Action action, EntityState newState, Object entity, String methodName)
at System.Data.Entity.Internal.Linq.InternalSet`1.Add(Object entity)
at System.Data.Entity.DbSet`1.Add(TEntity entity)
at LGK.Caelum.DataAccessLayer.GenericDataRepository`1.Add(T[] items) in d:\mlipp\dev\Caelum\CaelumDataAccessLayer\repositories\GenericDataRepository.cs:line 165
at CaelumDataAccessLayerTest.GenericDataRepositoryTest.TestItemRepositoryAdd() in d:\mlipp\dev\Caelum\CaelumDataAccessLayerTest\repositories\GenericDataRepositoryTest.cs:line 67
I am grateful for every input!

Thank you!