I update one MVC4 project using NuGet from EF5 to EF6a3 and exclude the reference to System.Data.Entity. Unfortunately I have some issues.
First, the web.config don't accept the <providers> element, just <contexts> and <defaultConnectionFactory>. At the top of web.config I have
First, the web.config don't accept the <providers> element, just <contexts> and <defaultConnectionFactory>. At the top of web.config I have
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
Second, I'm testing the EF6a3 with Npgsql. Besides the web.config issue I did the following configuration:<providers>
<provider invariantName="Npgsql" type="Npgsql.NpgsqlFactory, Npgsql"></provider>
</providers>
Dispite the alert message at compile time generated by the 'wrong' <providers> element the code runs but I receive the following exception, wich I'm not sure if it's a incompatibility between EF6a3 and Npgsql or a mistake in my configuration:The specified store provider cannot be found in the configuration, or is not valid.
em System.Data.Entity.Config.DefaultProviderFactoryResolver.GetService(Type type, Object key)
em System.Data.Entity.Config.CachingDependencyResolver.<>c__DisplayClass1.<GetService>b__0(Tuple`2 k)
em System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
em System.Data.Entity.Config.CachingDependencyResolver.GetService(Type type, Object key)
em System.Data.Entity.Config.ResolverChain.<>c__DisplayClass3.<GetService>b__0(IDbDependencyResolver r)
em System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
em System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
em System.Data.Entity.Config.ResolverChain.GetService(Type type, Object key)
em System.Data.Entity.Config.RootDependencyResolver.GetService(Type type, Object key)
em System.Data.Entity.Config.ResolverChain.<>c__DisplayClass3.<GetService>b__0(IDbDependencyResolver r)
em System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
em System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
em System.Data.Entity.Config.ResolverChain.GetService(Type type, Object key)
em System.Data.Entity.Config.CompositeResolver`2.GetService(Type type, Object key)
em System.Data.Entity.Config.IDbDependencyResolverExtensions.GetService[T](IDbDependencyResolver resolver, Object key)
em System.Data.Entity.Config.InternalConfiguration.GetService[TService](Object key)
em System.Data.Entity.Config.DbConfiguration.GetService[TService](Object key)
em System.Data.Entity.Internal.LazyInternalConnection.CreateConnectionFromProviderName(String providerInvariantName)
em System.Data.Entity.Internal.LazyInternalConnection.InitializeFromConnectionStringSetting(ConnectionStringSettings appConfigConnection)
em System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String name, AppConfig config)
em System.Data.Entity.Internal.LazyInternalConnection.Initialize()
em System.Data.Entity.Internal.LazyInternalConnection.get_ProviderName()
em System.Data.Entity.Internal.LazyInternalContext.get_ProviderName()
em System.Data.Entity.Internal.DefaultModelCacheKeyFactory.Create(DbContext context)
em System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
em System.Data.Entity.Internal.InternalContext.Initialize()
em System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
em System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
em System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
em System.Data.Entity.Internal.Linq.InternalSet`1.ActOnSet(Action action, EntityState newState, Object entity, String methodName)
em System.Data.Entity.Internal.Linq.InternalSet`1.Add(Object entity)
em System.Data.Entity.DbSet`1.Add(TEntity entity)
em MvcApplication7.Controllers.HomeController.Index() na c:\Users\Max\Documents\Visual Studio 2012\Projects\MvcApplication7\MvcApplication7\Controllers\HomeController.cs:linha 20
em lambda_method(Closure , ControllerBase , Object[] )
em System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
em System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
em System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
em System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass42.<BeginInvokeSynchronousActionMethod>b__41()
em System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _)
em System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()
em System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
em System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33()
em System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49()