There may be leftovers of different versions of Interfaces assembly, this might be the case?
Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Fri, Aug 7, 2009 at 10:30 PM, sbohlen <sboh...@gmail.com> wrote: > > I am trying to successfully leverage a combination of the fluent- > component registration and XML component registration in Windsor and > have seemingly hit a roadblock where it appears that each of the two > component registration 'techniques' needs to be wholly self-sustaining > in re: its component registrations...? > > As an example, assume I have the following two classes... > > public class MyService : IService > { > public ISubService SubService { get; set; } > > public MyService (ISubService subService) > { > SubService = subService; > } > } > > public class MySubService : ISubService > { > > } > > Basically, MyService has a dependency on ISubService (which is > implemented by the MySubService class. > > In my situation, I have the two interfaces, IService and ISubService, > defined in a single separate assembly. The MyService class is then > defined in a different assembly than the MySubService class, each of > their assemblies reference the common Interfaces assembly, of course. > > I presently have the following component registration sequence.... > > IWindsorContainer container = new WindsorContainer(); > > container.Register(Component.For<ISubService>() > .ImplementedBy<MySubService>() > .LifeStyle.Is(Castle.Core.LifestyleType.Transient)); > > container.Install(Configuration.FromXmlFile("Castle.cfg.xml")); > > ...and the relevant XML registration in my Castle.cfg.xml file is... > > <component id="theService" > service="IService, Interfaces" > type="MyService, ServiceAssembly" /> > > Even though the ISubDependency implementation, MySubDependency, has > already been registered in the container via the fluent interface, > when the following call is made in code.... > > IService theThing = container.Resolve<IService>(); > > ...I get a complaint from the container that it cannot resolve > IService because its waiting on an unsatisfied dependency of > ISubService (which it claims is not registered). > > Obviously, ISubService *is* already in the container as it was > registered via the fluent API (and I can confirm its there via > inspecting it in the debugger and calls to > container.Resolve<ISubService>() do succeed just fine). But somehow > it seems as though the container is not able to 'consider' > registrations that come from two differnt methods (e.g., one from the > fluent API and another from the XML file). > > Is this expected behavior, a bug, or is it that I'm just too dense to > grok what I'm doing wrong here...? > > From this experience, it would seem that while its possible combine > both fluent *and* xml-based component registrations, its *not* > possible to have a component registered via one method depend on a > component registered via the other method...? > > Any assistance appreciated~! > > -Steve B. > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to castle-project-users@googlegroups.com To unsubscribe from this group, send email to castle-project-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en -~----------~----~----~----~------~----~------~--~---