Given this XML configuration (which works)
<component type="X.Y.Z.ActivityService, X.Y.Z.Services" id="X.Y.Z.ActivityService" lifestyle="transient">
<parameters>
<Listeners>
<array>
<item>${DefaultActivityListener}</item>
</array>
</Listeners>
</parameters>
</component>
<component type="X.Y.Z.DefaultActi...
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 c...
Hi,
I am just getting started with the Fluent registration for Castle Windsor and cant figure out how I can reference properties I have defined in the properties section of my XML configuration file when registering. So I have this code to register a component.
RegisterComponent(componentId, Component.For<ConnectionConfig>()
...
I am using Castle Windsor in my own implementation of the Resolver Pattern. I have two implementations of a service MethodAService and MethodBService that both implement IMethodService. I am using "Convention Over Configuration" when bootstrapping Windsor in. How can I tell Castle Windsor to use always use MethodAService in one instance ...
How do I configure Castle Windsor to use an Initialize method for a static helper class when requesting an object? I am trying to add some extension methods HtmlHelper so it has to be a static class and method. My HtmlHelper extensions depend on a IHtmlHelpersService that is configured with Castle Windsor already. I am using Convention O...
I'm developing a web application using ASP.NET MVC and I'm using Windsor Castle as an IoC container (both WindsorControllerFactory and for my internal components). Currently I'm creating and storing the container into the Application (HttpApplicationState) like this:
protected void Application_Start()
{
...
IWind...
Hi,
I need some help - I am trying to use a custom validation attribute in an ASP.NET MVC web project that needs to make a database call.
I have windsor successfully working for the controllers and the IRepository interface is injected normally. The problem arrises when I need to inject the repository into the attribute class.
The at...
The below Unit Test fails, and I am looking for a valid reason for it doing so.
interface IFoo { }
class Foo : IFoo { }
class Foo2 : IFoo { }
[TestMethod]
public void LifestyleTest4()
{
WindsorContainer container = new WindsorContainer();
container.Register(Component.For<IFoo>().ImplementedBy<Foo>().Named("foo").LifeStyle.Sing...
Issue
I am using Castle Windsor as an IoC container in a Castle Monorail project. I would like to inject the current instance of IRailsEngineContext into an object being resolved from the container in a controller.
Context
The object I would like inject the rails context into would be used to wrap the session object for the purpose...
I have a custom membership/roles provider that I use in my MVC controllers that I also want to have accessible to ASP.NET MVC, so I can use AuthorizationFilters, etc. Since so many people have implemented custom providers I imagine many people have done this but I haven't figured it out or found postings that address this problem specifi...
(NOTE: I've updated this question from the initial inquiry about child containers towards creating components on-demand)
Here's my design problem: I'm using the Windsor container for the main application workflow, but I have certain actions I need to create on-demand (for example, when the user clicks on a menu item). I want these actio...
I'm attempting to use Windsor and NHibernate in a medium trust environment and I'm running up against some problems with permissions. I have read through the other questions on this but I'm using Windsor's NHibernate facility which I haven't seen discussed.
For some reason there is a dependency on the Castle.Service.Transations assembly...
I have a class that takes an array of interfaces in the constructor:
public class Foo<T1, T2> : IFoo<T1, T2>
{
public Foo(IBar[] bars)
{
...
}
}
My container registration looks as follows:
container.Register(AllTypes.Pick().FromAssemblyNamed("...")
.WithService.FirstInterface());
container.AddC...
I have a property on my classes for logging service.
private ILogger logger = NullLogger.Instance;
public ILogger Logger
{
get { return logger; }
set { logger = value; }
}
And I have this in my component registration:
container.AddFacility<LoggingFacility>(x => new LoggingFacility(LoggerImplementation.Log4net));
However, Wi...
Is there some kind of a shorthand fluent interface for creating a parameters dictionary to be provided to the IWindsorContainer.Resolve() method? Something like:
container.Resolve<ConsoleApp>(Parameters.Add("args", args).Add("banana", X).Add...)
...
I would like to use Castle Windsor 2.0 as the inversion of control container for my application and log4net 1.2.10 to provide logging services. Some Google searches suggest that Windsor provides some logging facilities and that I am supposed to create a public ILogger property on the classes that Windsor is instantiating. That sounds e...
I am having trouble compiling Castle Microkernel and Windsor for Silverlight 2.0. I am working with the current build on the trunk (5837).
I can build the InversionOfControl-vs2008-SL.sln solution fine and this generates Core-Silverlight.dll no problems, but will only build the Microkernel and Windsor assemblies for .net and not for Sil...
Is is possible to inject IPrincipal using Castle Windsor into my asp.net mvc controller. This article by Scott Hanselman has code in the comments to do it with structure map, but I cannot figure out how to do it with Castle.
Update:
Here is what I ended up with for my controller factory. Note that most of the code is from Steve Sanders...
I am trying to register the following class using the fluent interface:
public class DirectorySync : IDirectorySync
{
public DirectorySync(DirectoryInfo sourceDir, DirectoryInfo targetDir)
{
_sourceDirectory = sourceDir;
_targetDirectory = targetDir;
}
}
How do I go about specifying the DirectoryInfo instances? They shou...
It now makes sense that the versions aren't right.
I know I am using Castle Windsor 2.0 and I would like to use NHibernate with Fluent NHibernate - what versions do I need of these two?
Edit Ok, I think I got it wired up. I'm still having a version issue.
I now get this error when using the direct download from their site. The only lib...