I had the following code that was working well before the addition of Areas in MVC 2 :
protected override IWindsorContainer CreateContainer(string windsorConfig)
{
IWindsorContainer container = new WindsorContainer();
container.Register(Component.For<IUnitOfWorkFactory>()
.ImplementedBy<...
Hi all,
New to Castle/Windsor, please bear with me.
I am currently using the framework System.Web.Mvc.Extensibility and in its start up code, it registered HttpContextBase like the following:
container.Register(Component.For<HttpContextBase>().LifeStyle.Transient.UsingFactoryMethod(() => new HttpContextWrapper(HttpContext.Current)));
...
Hi
I am trying to get Windsor to give me an instance ISession for each request, which should be injected into all the repositories
Here is my container setup
container.AddFacility<FactorySupportFacility>().Register(
Component.For<ISessionFactory>().Instance(NHibernateHelper.GetSessionFactory()).LifeStyle.Singleton,
Component.F...
Consider this example:
public class Factory
{
private List<ISubFactory> subFactories;
public Factory(List<ISubFactory> subFactories)
{
this.subFactories = subFactories;
}
}
public interface ISubFactory
{
}
I want Windsor to resolve the Factory class and put all imp...
I have a class that i want to instantiate thru castle in configuration.
public class MyMappings : IMappings
{
Mapping FirstMapping { get; set; }
Mapping SecondMapping { get; set; }
OtherType ThirdMapping { get; set; }
OtherType FourthMapping { get; set; }
Mapping FifthMapping { get; set; }
OtherType SixMapping { ...
Hi everybody!
Currently, we use programming registration of WCF proxies in Windsor container using WCF Integration Facility. For example:
container.Register(
Component.For<CalculatorSoap>()
.Named("calculatorSoap")
.LifeStyle.Transient
.ActAs(new DefaultClientModel
{
Endpoint = WcfEndpoint.FromConfig...
How do I use the Castle WcfFacility and have it use the standard Wcf config file settings?
If I register like so:
container.Register(
AllTypes.Pick()
.FromAssemblyNamed("{ServicesAssembly}") // <-- service assembly here
.If(type => type.Name.EndsWith("Service"))
.WithService.FirstInterface()
.Configure(configurer => con...
I was using WindsorControllerFactory from mvccontrib.castle lib until now, after i migrated to mvc 2 it doesn't work anymore, I've downloaded the latest mvccontrib release and no factories in there
...
I have several WCF services which use castle windsor to resolve their dependencies. Now I need some of these services to talk to each other.
The typical structure is service --> Business Logic --> DAL
The calls to the other services need to occur at Business Logic level.
What is the best approach for implementing this?
Should I simp...
Hi,
I want to assert that my registrations are valid, i.e no dependency is missing and there are no circular dependencies.
I'd like to do that in my application (and not in a unit-test) so I'd be able to fail-fast if the configuration is invalid.
I also want to accomplish that without resolving (and instantiating) all the components - on...
I really can't get this working so i'm hoping someone here can help :)
here is my castle.config:
<castle>
<facilities>
<facility id="nhibernatefaciltity"
isWeb="true"
type="Castle.Facilities.NHibernateIntegration.NHibernateFacility, Castle.Facilities.NHibernateIntegration">
<factory id="sessionF...
I'm trying to execute an action on a resolved component before it is returned as a dependency to the application.
For example, with this graph:
public class Foo : IFoo { }
public class Bar {
IFoo _foo;
IBaz _baz;
public Bar(IFoo foo, IBaz baz) {
_foo = foo;
_baz = baz;
}
}
When I create an instance of IFoo, I want th...
Lets consider some cases:
_windsor.Register(Component.For<IProductServices>().ImplementedBy<ProductServices>().Interceptors(typeof(SomeInterceptorType));
In this case, when I ask for a IProductServices windsor will proxy the interface to intercept the interface method calls.
If instead I do this :
_windsor.Register(Component.For<Pr...
I have these base interfaces and providers in one assembly (Assembly1):
public interface IEntity
{
}
public interface IDao
{
}
public interface IReadDao<T> : IDao
where T : IEntity
{
IEnumerable<T> GetAll();
}
public class NHibernate<T> : IReadDao<T>
where T : IEntity
{
public IEnumerable<T> GetAll()
{
ret...
I've tried out the pooling lifestyle with Windsor.
Lets say I want multiple CustomerTasks to work with a pool of ILogger's.
when i try resolving more times than maxPoolSize, new loggers keeps getting created.
what am I missing and what exactly is the meaning of max pool size?
the xml configuration i use is (demo code):
<component id="...
I have many virtual methods in a class, but only one should be intercepted, Can I tell Castle Windsor to override only that method so I dont have to do validation in the Intercept method?
Edit:
I use the IKernelEvents.ComponentRegistered event to choose which types get the interceptor.
...
I'm currently reading Pro ASP.NET MVC Framework by Sanderson. In the book he recommends setting up IoC using Castle Windsor, and he points out that the download automatically installs it and registers the Castle DLLs in the GAC. Well, at this point in time (5/4/2010), the Castle Project no longer has a downloadable installer that sets ...
Hi,
I'm new to Castle Windsor, so I'm not sure what the best practise is in cases like the following:
I have a service interface (ILoader), that is implemented by multiple Loader classes. I also have an implementation of ILoader that's a decorator:
public interface ILoader { }
public class LoaderImpl0 : ILoader { }
public class LoaderI...
I am running into an issue when using my Castle Windsor Controller Factory with the new RenderAction method. I get the following error message:
A single instance of controller 'MyController' cannot be used to handle multiple requests. If a custom controller factory is in use, make sure that it creates a new instance of the controller f...
I am learning about best practices in MVC2 and I am knocking off a copy of the "Who Can Help Me" project (http://whocanhelpme.codeplex.com/) off Codeplex. In it, they use Castle Windsor for their DI container. One "learning" task I am trying to do is convert this subsystem in this project to use StructureMap.
Basically, at Application_...