Hi,
I'm trying to extend non-abstract abp entity (OrganizationUnit) and followed this document (<a class="postlink" href="https://www.aspnetzero.com/Documents/Ex">https://www.aspnetzero.com/Documents/Ex</a> ... g-Entities). When I build it, there's no error. But when I'm trying to access the services that initializes an IRepository of that extended entity, I'm getting an error. "An internal error occurred during your request!"
We're using .net core project
6 Answer(s)
-
0
Hi,
Can you check Logs.txt for a detailed error message ? Normally extending organization unit should be similar to one explained here <a class="postlink" href="https://www.aspnetzero.com/Documents/Extending-Existing-Entities">https://www.aspnetzero.com/Documents/Ex ... g-Entities</a>
-
0
Hi,
Here's what I got from the logs. We're just initializing the IRepository of the extended entity, same with the others but getting an error.
INFO 2017-04-05 08:20:22,781 [151 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://localhost:22742/api/services/app/OrganizationUnitHelper/GetOrganizationHelperUnits?TenantId=1&Filter=&MaxResultCount=10&SkipCount=0 INFO 2017-04-05 08:20:22,782 [151 ] entication.JwtBearer.JwtBearerMiddleware - Successfully validated the token. INFO 2017-04-05 08:20:22,782 [151 ] entication.JwtBearer.JwtBearerMiddleware - HttpContext.User merged via AutomaticAuthentication from authenticationScheme: Bearer. DEBUG 2017-04-05 08:20:22,782 [151 ] NetCore.StaticFiles.StaticFileMiddleware - The request path /api/services/app/OrganizationUnitHelper/GetOrganizationHelperUnits does not match a supported file type DEBUG 2017-04-05 08:20:22,782 [151 ] osoft.AspNetCore.Routing.Tree.TreeRouter - Request successfully matched the route with name '(null)' and template 'api/services/app/OrganizationUnitHelper/GetOrganizationHelperUnits'. DEBUG 2017-04-05 08:20:22,787 [151 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action MyCompanyName.AbpZeroTemplate.Organizations.OrganizationUnitHelperAppService.GetOrganizationHelperUnits (MyCompanyName.AbpZeroTemplate.Application) ERROR 2017-04-05 08:20:22,870 [151 ] Mvc.ExceptionHandling.AbpExceptionFilter - Can't create component 'MyCompanyName.AbpZeroTemplate.Organizations.OrganizationUnitHelperAppService' as it has dependencies to be satisfied. 'MyCompanyName.AbpZeroTemplate.Organizations.OrganizationUnitHelperAppService' is waiting for the following dependencies: - Service 'Abp.Domain.Repositories.IRepository`2[[MyCompanyName.AbpZeroTemplate.Authorization.OrganizationUnitHelper, MyCompanyName.AbpZeroTemplate.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' which was not registered. Castle.MicroKernel.Handlers.HandlerException: Can't create component 'MyCompanyName.AbpZeroTemplate.Organizations.OrganizationUnitHelperAppService' as it has dependencies to be satisfied. 'MyCompanyName.AbpZeroTemplate.Organizations.OrganizationUnitHelperAppService' is waiting for the following dependencies: - Service 'Abp.Domain.Repositories.IRepository`2[[MyCompanyName.AbpZeroTemplate.Authorization.OrganizationUnitHelper, MyCompanyName.AbpZeroTemplate.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' which was not registered. at Castle.MicroKernel.Handlers.DefaultHandler.AssertNotWaitingForDependency() at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden) at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired) at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, IDictionary additionalArguments, IReleasePolicy policy) at Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, IDictionary arguments, IReleasePolicy policy) at Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.GetServiceInternal(Type serviceType, Boolean isOptional) at Microsoft.AspNetCore.Mvc.Controllers.DefaultControllerFactory.CreateController(ControllerContext context) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextExceptionFilterAsync>d__24.MoveNext() DEBUG 2017-04-05 08:20:22,871 [151 ] ore.Mvc.Internal.ControllerActionInvoker - Request was short circuited at exception filter 'Abp.AspNetCore.Mvc.ExceptionHandling.AbpExceptionFilter'. DEBUG 2017-04-05 08:20:22,871 [151 ] etCore.Mvc.Internal.ObjectResultExecutor - Selected output formatter 'Microsoft.AspNetCore.Mvc.Formatters.JsonOutputFormatter' and content type 'application/json' to write the response. INFO 2017-04-05 08:20:22,871 [151 ] etCore.Mvc.Internal.ObjectResultExecutor - Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. INFO 2017-04-05 08:20:22,871 [151 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action MyCompanyName.AbpZeroTemplate.Organizations.OrganizationUnitHelperAppService.GetOrganizationHelperUnits (MyCompanyName.AbpZeroTemplate.Application) in 84.4749ms DEBUG 2017-04-05 08:20:22,871 [151 ] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HL3RLQHP2447" completed keep alive response. INFO 2017-04-05 08:20:22,871 [151 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 90.0225ms 500 application/json; charset=utf-8
-
0
Hi,
Is OrganizationUnitHelper is an entity ? If so, you should add it to your DbContext, probably that is the reason of your problem.
Thanks.
-
0
OrganizationUnitHelper is an extended entity of OrganizationUnit. We're just adding 1 field to OrganizationUnit, and it already reflected in the DB.
Probably, it's what you said, I need to put it in DBContext coz Im trying to initialize it on IRepository, but I'm thinking that it will try to create a new table of OrganizationUnitHelper? Where it should not coz it's just an extended entity.
I'm gonna try anyways and let you know.
-
0
Okay, that's right. Adding to DBContext resolve the issue. Thanks! :)
-
0
Great :)