我正在使用EF Profiler和EF 6.1.1。
在托管我的Web-API(单独项目)的Startup.cs文件中实现此行:
HibernatingRhinos.Profiler.Appender.EntityFramework.EntityFrameworkProfiler.Initialize();
该项目还有2个不同的上下文,1个用于ShardManagerDb,1个用于ShardedDb。
问题:
我运行主机项目一切正常工作,EF Profiler运行我从Web-API点击ShardManagerContext时获取查询,当我尝试在ShardedDbContext上执行Add方法时出现问题。
这是EF 6.1.1中与EF Profiler一起出现的错误吗? 如果我删除HibernatingRhinos.Profiler.Appender.EntityFramework.EntityFrameworkProfiler.Initialize();从我的Startup.cs开始,一切都按预期工作。
如何在不删除EF Profiler的情况下解决此问题?
异常消息:
无法确定类型的提供程序工厂的提供程序名称 'System.Data.SqlClient.SqlClientFactory'。确保ADO.NET provider已在应用程序配置中安装或注册。
堆栈跟踪:
VID System.Data.Entity.Utilities.DbProviderFactoryExtensions.GetProviderInvariantName(DbProviderFactory 工厂)vid System.Data.Entity.Infrastructure.DependencyResolution.DefaultInvariantNameResolver.GetService(类型 type,Object key)vid System.Data.Entity.Infrastructure.DependencyResolution.CachingDependencyResolver<> c__DisplayClass1.b__0(元组
2 k) vid System.Collections.Concurrent.ConcurrentDictionary
2.GetOrAdd(TKEY的 key,Func2 valueFactory) vid System.Data.Entity.Infrastructure.DependencyResolution.CachingDependencyResolver.GetService(Type type, Object key) vid System.Data.Entity.Infrastructure.DependencyResolution.ResolverChain.<>c__DisplayClass3.<GetService>b__0(IDbDependencyResolver r) vid System.Linq.Enumerable.WhereSelectArrayIterator
2.MoveNext() vid System.Linq.Enumerable.FirstOrDefault [TSource](IEnumerable1 source, Func
2谓词)vid System.Data.Entity.Infrastructure.DependencyResolution.ResolverChain.GetService(类型 type,Object key)vid System.Data.Entity.Infrastructure.DependencyResolution.RootDependencyResolver.GetService(类型 type,Object key)vid System.Data.Entity.Infrastructure.DependencyResolution.ResolverChain&LT;&GT; c__DisplayClass3.b__0(IDbDependencyResolver r)vid System.Linq.Enumerable.WhereSelectArrayIterator2.MoveNext() vid System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable
1 source,Func2 predicate) vid System.Data.Entity.Infrastructure.DependencyResolution.ResolverChain.GetService(Type type, Object key) vid System.Data.Entity.Infrastructure.DependencyResolution.CompositeResolver
2.GetService(Type type,Object key)vid System.Data.Entity.Infrastructure.DependencyResolution.DbDependencyResolverExtensions.GetService [T](IDbDependencyResolver 解析器,对象键)vid System.Data.Entity.Utilities.DbConnectionExtensions.GetProviderInvariantName(的DbConnection 连接)vid System.Data.Entity.Internal.InternalConnection.get_ProviderName()
vid System.Data.Entity.Internal.LazyInternalContext.get_ProviderName() VID System.Data.Entity.Internal.DefaultModelCacheKeyFactory.Create(的DbContext 上下文)vid System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
vid System.Data.Entity.Internal.InternalContext.Initialize()vid System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(类型 entityType)vid System.Data.Entity.Internal.Linq.InternalSet1.Initialize() vid System.Data.Entity.Internal.Linq.InternalSet
1.get_InternalContext()
vid System.Data.Entity.Internal.Linq.InternalSet1.ActOnSet(Action action, EntityState newState, Object entity, String methodName) vid System.Data.Entity.Internal.Linq.InternalSet
1.Add(Object entity)
vid System.Data.Entity.DbSet1.Add(TEntity entity) vid Dexter.Data.EF.Shard.Repositories.SalonRepositoryBase
1.添加(T实体) 一世 C:\开发\ GIT \ Itsperfect \德克斯特\ Dexter.Data.EF.Shard \库\ SalonRepositoryBase.cs:弧度 30 vid Dexter.Data.EF.Shard.Repositories.ConvertedDataRepository.InsertSalonData(沙龙 沙龙)我 C:\开发\ GIT \ Itsperfect \德克斯特\ Dexter.Data.EF.Shard \库\ ConvertedDataRepository.cs:弧度 19