Hi, I already got it to work. I suppose it had something to do with my custom repository method. Not quit sure, but its working. Do by yourself is the best way to learn!! :) :)
thanks for the support..
Hi, below was the complete stack. I already fixed this and I am no longer getting this error.
{
"message": "An error has occurred.",
"exceptionMessage": "ComponentActivator: could not proxy Abp.WebApi.Controllers.Dynamic.DynamicApiController`1[[Example.Tenants.Dashboard.ITenantDashboardAppService, Example.Application, Version=1.10.1.0, Culture=neutral, PublicKeyToken=null]]",
"exceptionType": "Castle.MicroKernel.ComponentActivator.ComponentActivatorException",
"stackTrace": " at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext context, ConstructorCandidate constructor, Object[] arguments)\r\n at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context)\r\n at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context)\r\n at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden)\r\n at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, Boolean trackedExternally)\r\n at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy)\r\n at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden)\r\n at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired)\r\n at Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext context)\r\n at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, IDictionary additionalArguments, IReleasePolicy policy)\r\n at Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, IDictionary arguments, IReleasePolicy policy)\r\n at Castle.MicroKernel.DefaultKernel.Resolve(Type service, IDictionary arguments)\r\n at Castle.Windsor.WindsorContainer.Resolve(Type service)\r\n at Abp.Dependency.IocManager.Resolve(Type type) in D:\\Halil\\GitHub\\aspnetboilerplate\\src\\Abp\\Dependency\\IocManager.cs:line 194\r\n at Abp.Dependency.IocResolverExtensions.ResolveAsDisposable[T](IIocResolver iocResolver, Type type) in D:\\Halil\\GitHub\\aspnetboilerplate\\src\\Abp\\Dependency\\IocResolverExtensions.cs:line 32\r\n at Abp.WebApi.Controllers.AbpApiControllerActivator.Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType) in D:\\Halil\\GitHub\\aspnetboilerplate\\src\\Abp.Web.Api\\WebApi\\Controllers\\AbpApiControllerActivator.cs:line 24\r\n at System.Web.Http.Controllers.HttpControllerDescriptor.CreateController(HttpRequestMessage request)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()",
"innerException": {
"message": "An error has occurred.",
"exceptionMessage": "Can't create component 'Example.Tenants.Dashboard.TenantDashboardAppService' as it has dependencies to be satisfied.\r\n\r\n'Example.Tenants.Dashboard.TenantDashboardAppService' is waiting for the following dependencies:\r\n- Service 'Example.MultiTenancy.IPortalRepository' which was not registered.\r\n",
"exceptionType": "Castle.MicroKernel.Handlers.HandlerException",
"stackTrace": " at Castle.MicroKernel.Handlers.DefaultHandler.AssertNotWaitingForDependency()\r\n at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden)\r\n at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired)\r\n at Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext context)\r\n at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveFromKernelByType(CreationContext context, ComponentModel model, DependencyModel dependency)\r\n at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveFromKernel(CreationContext context, ComponentModel model, DependencyModel dependency)\r\n at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveCore(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency)\r\n at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.Resolve(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency)\r\n at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateConstructorArguments(ConstructorCandidate constructor, CreationContext context)\r\n at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context)\r\n at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context)\r\n at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden)\r\n at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, Boolean trackedExternally)\r\n at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy)\r\n at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden)\r\n at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired)\r\n at Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext context)\r\n at Castle.Core.InterceptorReference.Castle.MicroKernel.IReference<Castle.DynamicProxy.IInterceptor>.Resolve(IKernel kernel, CreationContext context)\r\n at Castle.Windsor.Proxy.AbstractProxyFactory.ObtainInterceptors(IKernel kernel, ComponentModel model, CreationContext context)\r\n at Castle.Windsor.Proxy.DefaultProxyFactory.Create(IKernel kernel, Object target, ComponentModel model, CreationContext context, Object[] constructorArguments)\r\n at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext context, ConstructorCandidate constructor, Object[] arguments)"
}
}
But when I run the project, I get "An internal error occurred during your request!". Then I tried to debug it and I noticed that it fails at (code below) inside the implementation class TenantDashboardAppService
public ListResultOutput<EventLiveFeeds> GetEventLiveFeeds()
{
var events = _eventLiveFeeds
.GetAll()
.ToList();
return new ListResultOutput<EventLiveFeeds>(events.MapTo<List<EventLiveFeeds>>());
}
With an error saying "{"The entity type EventLiveFeeds is not part of the model for the current context."}". Here (code below) is my entity class. Am I doing something wrong here?
namespace Example.MultiTenancy
{
using Abp.Domain.Entities;
using Abp.Domain.Entities.Auditing;
using System.ComponentModel.DataAnnotations.Schema;
[Table("tbl_DashboardStatistics")]
public class TenantStatistics : FullAuditedEntity, IMustHaveTenant
{
public virtual int TenantId { get; set; }
public virtual string TotalCheckins { get; set; }
public virtual string TotalWalkins { get; set; }
public virtual string TotalTransactions { get; set; }
}
public class EventLiveFeeds : Entity
{
public virtual int stars { get; set; }
public virtual string review { get; set; }
public virtual string Date { get; set; }
}
}
thanks
Hi, thanks for the reply.
first problem is naming: You named interface as 'IPotalRepository' but implementation as 'PortalRepository'. Interface name should be 'IPortalRepository'.
it was a typing error.
second one is you should directly inject and use IPortalRepository (not IRepository<EventLiveFeeds> or IPortalRepository<EventLiveFeeds>).
i had already figured that out. Also the reason why I used the IRepository in the injection was because i could not call the IPortalRepository in the application service. But I figure that out as well, by declaring my IPortalRepository in the Core layer. Which looks fine.
The issue i am having now is that, I am not able to call the GetEventLiveFeeds(), as it keeps failing. How can fix this?
"message": "An error has occurred.",
"exceptionMessage": "ComponentActivator: could not proxy Abp.WebApi.Controllers.Dynamic.DynamicApiController`1[[Example.Tenants.Dashboard.ITenantDashboardAppService, Example.Application, Version=1.10.1.0, Culture=neutral, PublicKeyToken=null]]",
"exceptionType": "Castle.MicroKernel.ComponentActivator.ComponentActivatorException",
Its also important to know that i want to be able to read sql Views and Stores procedures that is why I am using the custom repository. Also the custom repository is should use the Default database connection. I hoope I am on the right track. Below is implementation code
namespace Example.Tenants.Dashboard
{
[AbpAuthorize(AppPermissions.Pages_Tenant_Dashboard)]
public class TenantDashboardAppService : ExampleAppServiceBase, ITenantDashboardAppService
{
private readonly IPortalRepository _eventLiveFeeds;
public TenantDashboardAppService( IPortalRepository eventLiveFeeds)
{
_eventLiveFeeds = eventLiveFeeds;
}
public ListResultOutput<EventLiveFeeds> GetEventLiveFeeds()
{
var events = _eventLiveFeeds
.GetAll()
.ToList();
return new ListResultOutput<EventLiveFeeds>(events.MapTo<List<EventLiveFeeds>>());
}
}
}
thanks.