Base solution for your next web application
Open Closed

Exception on Odata Service with latest version 0.9.7 #1421


User avatar
0
mayureshpisal created

HI ,

I explain you my architecture as below I want to develop Multi-tenant – multi databases: One database for the host (master) and separate databases for each tenant. We can have a HostDbContext (contains only host side entities) and a TenantDbContext (contains only tenant side entities).

Previously I developed one OData service and its working fine but after up gradation with 0.9.7 version I faced a lot of issues.Below is List

  1. major Issue is when I want to add TenantDB context in Entity framework then below error occurs

"Found more than one concrete type for given DbContext Type" I resolved this issue with the help of the previous issue.(#1097) Means this issue is not resolved in 0.9.7 version

  1. When I try to get Customer Data using OData Service below Exception Occurs { "message": "An error has occurred.", "exceptionMessage": "Could not find a public constructor for type ~Base`1[~.Customer].\r\nWindsor by default cannot instantiate types that don't expose public constructors.\r\nTo expose the type as a service add public constructor, or use custom component activator.", "exceptionType": "Castle.MicroKernel.ComponentActivator.ComponentActivatorException", "stackTrace": " at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.FastCreateInstance(Type implType, Object[] arguments, ConstructorCandidate constructor)\r\n at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, Object[] arguments, Type implType)\r\n 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.Handlers.DefaultGenericHandler.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.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 195\r\n at Abp.Dependency.IocResolverExtensions.ResolveAsDisposableT 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.d__1.MoveNext()" }

A customer is my tenant Entity and I want to access this entity with the help of _unitOfWorkManager.Current.SetTenantId(tenantId)

  1. In UserApp and Notification service, I face below issue

//Notifications await _notificationSubscriptionManager.SubscribeToAllAvailableNotificationsAsync(user.TenantId, user.Id); I had Changed this call to as below Abp.UserIdentifier UserIdentifier = new UserIdentifier(user.TenantId, user.Id); await _notificationSubscriptionManager.SubscribeToAllAvailableNotificationsAsync(UserIdentifier);

So it's written is Correct ? or any other changes is here?

  1. AppNotifier.cs below two methods I face issue public async Task WelcomeToTheApplicationAsync(User user) { await _notificationPublisher.PublishAsync( AppNotificationNames.WelcomeToTheApplication, new MessageNotificationData(L("WelcomeToTheApplicationNotificationMessage")), severity: NotificationSeverity.Success, userIds: new[] { user.Id } ); }

public async Task SendMessageAsync(long userId, string message, NotificationSeverity severity = NotificationSeverity.Info) { await _notificationPublisher.PublishAsync( "App.SimpleMessage", new MessageNotificationData(message), severity: severity, userIds: new[] { userId } ); }

How I can resolved this Issue .


No answer yet!