question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue: Found more than one concrete type for given DbContext Type After Upgrading to Abp 0.9.3

See original GitHub issue

Hi,

Background

I’ve a multi module system and every module has itsown DbContext. All the modules’ DbContext inherits the base module DbContext which in turns inherits the AboZeroDbContext.

The Issue

After upgrading to Abp 0.9.3 I got the below exception everywhere in the system.

Found more than one concrete type for given DbContext Type (HRPayroll.Data.HrPayrollDbContext) but none of them defines MultiTenancySideAttribute with Host. Found types: .

Stack trace:

[AbpException: Found more than one concrete type for given DbContext Type (DreamApp.Data.DreamAppDbContext) but none of them defines MultiTenancySideAttribute with Host. Found types: .]
   Abp.EntityFramework.DbContextTypeMatcher.GetConcreteType(Type sourceDbContextType) in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\DbContextTypeMatcher.cs:129
   Abp.EntityFramework.Uow.EfUnitOfWork.GetOrCreateDbContext(Nullable`1 multiTenancySide) in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\Uow\EfUnitOfWork.cs:140
   Abp.EntityFramework.Repositories.EfRepositoryBase`3.get_Table() in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\Repositories\EfRepositoryBaseOfTEntityAndTPrimaryKey.cs:30
   Abp.EntityFramework.Repositories.<GetAllListAsync>d__7.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\Repositories\EfRepositoryBaseOfTEntityAndTPrimaryKey.cs:50
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +13891908
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61
   Abp.Threading.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__5`1.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Threading\InternalAsyncHelper.cs:120
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +13891908
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61
   Abp.Threading.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__5`1.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Threading\InternalAsyncHelper.cs:120
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +13891908
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61
   Abp.Localization.<GetLanguagesFromDatabaseAsync>d__17.MoveNext() in D:\Halil\GitHub\module-zero\src\Abp.Zero\Localization\ApplicationLanguageManager.cs:204
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +13891908
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61
   Abp.Threading.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__5`1.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Threading\InternalAsyncHelper.cs:120
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +13891908
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61
   Abp.Runtime.Caching.<<GetAsync>b__0>d.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Runtime\Caching\CacheExtensions.cs:0
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +13891908
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61
   Abp.Runtime.Caching.<GetAsync>d__12.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Runtime\Caching\CacheBase.cs:67
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +13891908
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61
   Abp.Runtime.Caching.<GetAsync>d__5`2.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Runtime\Caching\CacheExtensions.cs:38
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +13891908
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61
   Abp.Localization.<GetLanguageDictionary>d__15.MoveNext() in D:\Halil\GitHub\module-zero\src\Abp.Zero\Localization\ApplicationLanguageManager.cs:178
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +13891908
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61
   Abp.Localization.<GetLanguagesAsync>d__8.MoveNext() in D:\Halil\GitHub\module-zero\src\Abp.Zero\Localization\ApplicationLanguageManager.cs:60
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +13891908
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61
   Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException(Task`1 task) +48
   System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke() +108
   System.Threading.Tasks.Task.Execute() +71
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +13891908
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61
   Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException(Task`1 task) +48
   Nito.AsyncEx.AsyncContext.Run(Func`1 action) +382
   Abp.Localization.ApplicationLanguageProvider.GetLanguages() in D:\Halil\GitHub\module-zero\src\Abp.Zero\Localization\ApplicationLanguageProvider.cs:35
   Abp.Localization.LanguageManager.GetCurrentLanguage() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Localization\LanguageManager.cs:26
   DreamApp.Sessions.SessionAppService.SetCurrentUiCulture() in d:\src\DreamApp\src\DreamApp.Application\Sessions\SessionAppService.cs:36
   Castle.DynamicProxy.AbstractInvocation.Proceed() +111
   Castle.DynamicProxy.AbstractInvocation.Proceed() +448
   Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:54
   Castle.DynamicProxy.AbstractInvocation.Proceed() +448
   Castle.DynamicProxy.AbstractInvocation.Proceed() +448
   Castle.DynamicProxy.AbstractInvocation.Proceed() +448
   DreamApp.Web.Controllers.DreamAppControllerBase..ctor() in d:\src\DreamApp\src\DreamApp.Web\Controllers\DreamAppControllerBase.cs:19
   DreamApp.Web.Controllers.HomeController..ctor() +43

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeConstructorInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +438
   Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.FastCreateInstance(Type implType, Object[] arguments, ConstructorCandidate constructor) +106
   Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, Object[] arguments, Type implType) +62

[ComponentActivatorException: ComponentActivator: could not instantiate DreamApp.Web.Controllers.HomeController]
   Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, Object[] arguments, Type implType) +335
   Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext context, ConstructorCandidate constructor, Object[] arguments) +284
   Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context) +29
   Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden) +26
   Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, Boolean trackedExternally) +62
   Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy) +28
   Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden) +294
   Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired) +33
   Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, IDictionary additionalArguments, IReleasePolicy policy) +170
   Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, IDictionary arguments, IReleasePolicy policy) +73
   Abp.Dependency.IocManager.Resolve(Type type) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Dependency\IocManager.cs:171
   System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +103
   System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +268
   System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +95
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +923
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +137

Any thoughts ?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
hikalkancommented, Jun 19, 2016

OK, released v0.9.5. Just upgrade nuget packages and remove your custom code. Have a nice day.

0reactions
iyhammadcommented, Jun 19, 2016

You Welcome. I really enjoy working with ABP on daily basis.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Found more than one concrete type for given ... - Support
The problem here is that: You inject IRepository<User, long>, but how ABP can know which DbContext to use? Is one of your DbContext...
Read more >
More than one DbContext was found
When I try running the dotnet migration, dotnet ef migrations add InitialCreate I get the following error: "More than one DbContext was found....
Read more >
More than one DBContext was found. #1662 - ABP Commercial
Updating the Databases. It is suggested to run the DbMigrator application to update the database after adding a new migration. It is simpler...
Read more >
Bugs & Issues v4.1.X #626 | Support Center | ABP Commercial
Much more testing of the create new module system is needed! Basicially i was trying to find a way to install the Identity...
Read more >
Untitled
Disc personality types d, Ul prosta 51 rzeczpospolita, 311 virginia beach 2013 ... Gowino hotel, Multiple model form rails, L figaro, Black and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found