我正在使用 UConnector 下载订单并更新状态。实际下载按预期工作,但是当我尝试更新状态时收到错误消息。我已经评论了导致代码错误的行。我希望有人能告诉我我错过了什么?
我的 Component.config
<configuration>
<components>
<component
id="SessionProvider"
service="UCommerce.EntitiesV2.ISessionProvider, UCommerce"
type="UCommerce.EntitiesV2.SessionProvider, UCommerce"/>
<component id="UCommerce.DataMappingsTag"
service="UCommerce.EntitiesV2.IContainsNHibernateMappingsTag, UCommerce"
type="UCommerce.EntitiesV2.MappingAssemblyTag, UCommerce"/>
<component id="OrderService"
service="UCommerce.Transactions.IOrderService, UCommerce"
type="UCommerce.Transactions.OrderService, UCommerce"/>
<component id="Repository"
service="UCommerce.EntitiesV2.IRepository`1, UCommerce"
type="UCommerce.EntitiesV2.Repository`1, UCommerce"/>
</components>
</configuration>
代码
var orderService = ObjectFactory.Instance.Resolve<IOrderService>();
//var newOrderStatus = OrderStatus.Get((int)OrderStatusCode.Processing); //This line
var newOrderStatus = OrderStatus.All().SingleOrDefault(x => x.Name == "Processing"); //OR this line give the same error
orderService.ChangeOrderStatus(item, newOrderStatus);
错误:
ComponentActivator:无法实例化 UCommerce.EntitiesV2.SessionProvider
内部异常:
{“未找到支持服务 UCommerce.Infrastructure.Configuration.CommerceConfigurationProvider 的组件”}
堆栈跟踪:
在 Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext 上下文,ConstructorCandidate 构造函数,Object[] 参数)的 Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate 构造函数,Object[] 参数,类型 implType) .DefaultComponentActivator.Instantiate(CreationContext context) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context) at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden负担) at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance( CreationContext 上下文,Boolean trackedExternally) at Castle.MicroKernel.Lifestyle.ScopedLifestyleManager.<>n__FabricatedMethod3(CreationContext , Boolean ) at Castle.MicroKernel.Lifestyle.ScopedLifestyleManager.<>c__DisplayClass1.b__0(Action
1 afterCreated) at Castle.MicroKernel.Lifestyle.Scoped.DefaultLifetimeScope.GetCachedInstance(ComponentModel model, ScopedInstanceActivationCallback createInstance) at Castle.MicroKernel.Lifestyle.ScopedLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy) 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.Handlers.AbstractHandler.Resolve(CreationContext context) at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveFromKernelByType(CreationContext context, ComponentModel model, DependencyModel dependency) at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveFromKernel(CreationContext context, ComponentModel model, DependencyModel dependency) at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveCore(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency) at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.Resolve(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateConstructorArguments(ConstructorCandidate constructor, CreationContext context) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context) at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden) at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, Boolean trackedExternally) at Castle.MicroKernel.Lifestyle.ScopedLifestyleManager.<>n__FabricatedMethod3(CreationContext , Boolean ) at Castle.MicroKernel.Lifestyle.ScopedLifestyleManager.<>c__DisplayClass1.b__0(Action
1 afterCreated) at Castle.MicroKernel.Lifestyle.Scoped.DefaultLifetimeScope.GetCachedInstance(ComponentModel model, ScopedInstanceActivationCallback createInstance) at Castle.MicroKernel.Lifestyle.ScopedLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy) at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore( CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden&负担) at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired) at Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext context) at Castle.MicroKernel.Handlers。 Castle.MicroKernel.Handlers.AbstractHandler 中的 DefaultGenericHandler.Resolve(CreationContext context, Boolean instanceRequired)。在 Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve 的 Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler 处理程序,类型服务,IDictionary additionalArguments,IReleasePolicy 策略)的 Resolve(CreationContext 上下文)(类型服务,IDictionary 参数,IReleasePolicy 策略)在 Castle.MicroKernel.DefaultKernel.Resolve(类型服务,IDictionary 参数) 在 Castle.Windsor.WindsorContainer.ResolveT 在 UCommerce.Infrastructure.ObjectFactory.ResolveT 在 UCommerce.EntitiesV2.OrderStatus.GetRepo() 在 UCommerce.EntitiesV2.OrderStatus.All( ) 在 SiteConnector.Classes.OrdersListToCalClub.Send(IEnumerable`1 输入)MicroKernel.IKernelInternal.Resolve(Type service, IDictionary arguments, IReleasePolicy policy) at Castle.MicroKernel.DefaultKernel.Resolve(Type service, IDictionary arguments) at Castle.Windsor.WindsorContainer.ResolveT at UCommerce.Infrastructure.ObjectFactory.ResolveT at UCommerce.EntitiesV2 .OrderStatus.GetRepo() 在 UCommerce.EntitiesV2.OrderStatus.All() 在 SiteConnector.Classes.OrdersListToCalClub.Send(IEnumerable`1 输入)MicroKernel.IKernelInternal.Resolve(Type service, IDictionary arguments, IReleasePolicy policy) at Castle.MicroKernel.DefaultKernel.Resolve(Type service, IDictionary arguments) at Castle.Windsor.WindsorContainer.ResolveT at UCommerce.Infrastructure.ObjectFactory.ResolveT at UCommerce.EntitiesV2 .OrderStatus.GetRepo() 在 UCommerce.EntitiesV2.OrderStatus.All() 在 SiteConnector.Classes.OrdersListToCalClub.Send(IEnumerable`1 输入)发送(IEnumerable`1 输入)发送(IEnumerable`1 输入)