castle-windsor

Castle Windsor: How can I update a components registration

倖福魔咒の 提交于 2019-12-12 13:59:34
问题 If I have defined in config: container.Register( Component.For<X.Y.Z.IActivityService>() .ImplementedBy<X.Y.Z.ActivityService>() .ServiceOverrides(ServiceOverride.ForKey("Listeners").Eq(new [] { typeof(X.Y.Z.DefaultActivityListener).FullName })) .LifeStyle.Transient ); and I wish to extend this configuration and add a new item to the Listeners array property such that the final configuration is effectively: container.Register( Component.For<X.Y.Z.IActivityService>() .ImplementedBy<X.Y.Z

castle IOC - resolving circular references

本秂侑毒 提交于 2019-12-12 13:45:41
问题 quick question for my MVP implementation: currently I have the code below, in which both the presenter and view are resolved via the container. Then the presenter calls View.Init to pass himself to the view. I was wondering however if there is a way to let the container fix my circular reference (view -> presenter, presenter -> view). class Presenter : IPresenter { private View _view; public Presenter(IView view, ...){ _view = view; _view.Init(this) } } class View : IView { private IPresenter

Circular dependency tree, justified or not

冷暖自知 提交于 2019-12-12 11:49:11
问题 I've came up with some solution on which my IoC/DI container ( Castle Windsor ) is claiming that there's a cyclic dependency tree. And it's true. But I'm not that sure that this cycle is that harmful. This is, more or less, the dependency tree: A WebAPI controller depends on... ...a service A depends on... ...an unit of work depends on... ...a repository depends on... ...a domain event manager (1) depends on many... ...domain event handlers, and one depends on... ... service A (2) (1) A

Registering an Interceptor For All Interface Implementations in Castle Windsor

眉间皱痕 提交于 2019-12-12 10:03:54
问题 I'm fairly new to Castle Windsor and in particular using Interceptors and am wondering if it is possible to register an Interceptor across all implementations of a particular interface without specifying each implementation in turn. For example, I have an interface called IComponent which will be implemented by a number of classes. I have a ComponentInterceptor class written to act on these classes when they have executed a particular method. I would like to do something like: _container

How to register a ISolrFieldSerializer in Windsor container so that SolrNet can pick it up

亡梦爱人 提交于 2019-12-12 04:13:55
问题 I am trying to get an enum to serialize to it's int value when posting to Solr. So I have implemented a ISolrFieldSerializer to do this, As suggested here. But I can seem to register it within the Windsor container in a way that it then gets used by SolrNet Here is what I have: This works fine apart from the serializer does not get used, although it appears in the containers components list. Any ideas? container.Register(Component.For<ISolrFieldSerializer>().ImplementedBy<SolrEnumSerializer>(

Why is my Web API call returning “No action was found on the controller 'DPlatypus' that matches the request”?

浪尽此生 提交于 2019-12-12 02:35:09
问题 I am trying to create the simplest possible ASP.NET Web API app that incorporates and uses DI with Castle Windsor. I have a working app that is more complicated, and I have tried to copy the "bare bones" from it (as little as possible and still have it work). The working app has this URL ("Home Page"): http://localhost:28642/ Entering this: http://shannon2:28642/api/Departments/Count ...in my browser returns the data I want, from the Departments Controller. However, the new/simple/non-working

Why is HomeController getting referenced, and how do I support it (assuming I should)?

限于喜欢 提交于 2019-12-12 01:49:56
问题 This is sort of a Helleresque (Catch-22) situation; or perhaps more appropriately "unrepositoried if I do, and unrepositoried if I don't" With this Castle Windsor Controller Factory: public class WindsorControllerFactory : DefaultControllerFactory { private readonly IKernel _kernel; public WindsorControllerFactory(IKernel kernel) { _kernel = kernel; //According to http://docs.castleproject.org/Windsor.Typed-Factory-Facility.ashx, might need this: //_kernel.AddFacility<TypedFactoryFacility>();

Castle Windsor 2.5 Breaking Changes

谁说胖子不能爱 提交于 2019-12-12 01:37:02
问题 I have code that was previously adding ExtendedProperties to components like component.ExtendedProperties( new { prop = someObject }); This method is no longer available and the constructor for Property is marked internal. Is there a new way of doing this for v2.5? Specifically, I have a custom ComponentActivator that needs some instance information at resolution time from the initial registration. I have been storing this information in the ExtendedProperties then retrieving it in the

Castle remoting facility not working

跟風遠走 提交于 2019-12-12 01:35:10
问题 Does remoting facility still work in castle? i downloaded sample from http://www.castleproject.org/container/facilities/trunk/remoting/usingit.html changed project to target 4.0 of framework. Then I deleted references to castle in both client and server projects and then added references to Castle.Core and Castle.Windsor dlls from castles "bin-dotNet40" folder. When I run the server I get the follwoing exception: Could not convert from 'Castle.Facilities.Remoting.RemotingFacility, Castle

How to tell use relevant registered MySession class by name

妖精的绣舞 提交于 2019-12-12 01:27:20
问题 I have project created from Boilerplate I have MySession class that will be used from MvcControllers and WebApi Controllers. In MySession has two derived classes: MySessionMvc: public override string UserId { get { return Thread.CurrentPrincipal.Identity.GetUserId(); } } and MySessionWebApi: public override string UserId { get { System.Web.HttpContext.Current.Request.Headers["UserId"]; } } I register both classes: IocManager.RegisterIfNot<IMySession, MySessionMvc>(DependencyLifeStyle