I recently read Ayende's blog post on automatic registration working with XML Configuration. I would like to do exactly what he does, but his code snippet doesn't work for me. The Register method doesn't exist on my container object.
Here's his code:
var container = new WindsorContainer(new XmlInterpreter());
container.Register(
Al...
I am using Castle Windosr container. I want to be able to specify some constructor dependencies at runtime which you can obviously do by using a Resolve overload that takes a dictionary, all good and fine. However if I want to specify runtime dependency for a dependency of the root then I'm lost, at the moment I've worked around by expli...
If I registered several components with Windsor.
IAnimal provides BigAnimal
IPerson provides SmellyPerson
IWhale provides BlueWhale
etc.. pretty standard component registeration
all the above types implement IMustBeIntercepted, how do I tell the container add an interceptor to all types that implement IMustBeImplemented so that when R...
I register my two interfaces on application start as so:-
container.Register(Component.For(typeof(IEntityIndexController)).ImplementedBy(typeof(SnippetController)).LifeStyle.Transient);
container.Register(Component.For(typeof(ISnippetController)).ImplementedBy(typeof(SnippetController)).LifeStyle.Transient);
Then when I try to run an ...
Take the following useless program:
class Program
{
static void Main(string[] args)
{
IUnityContainer unityContainer = new UnityContainer();
IWindsorContainer windsorContainer = new WindsorContainer();
Program unityProgram = unityContainer.Resolve<Program>();
Program castleProgram = windsorContai...
I have two assemblies EDC2.DAL and EDC2 where EDC2.DaoInterfaces defines a bunch of interfaces for data access objects to objects in the EDC2.Domain namespace. These are all implemented by classes in EDC2.DAL.
So to give an example:
Assembly EDC2
Namespace EDC2.DaoInterfaces
ICustomerDao
IProductDao
Assembly EDC2.DAL
Name...
I am learning castle.windsor following the tutorial online. this is the simple sample code:
public class Form1 {
private readonly HttpServiceWatcher serviceWatcher;
private System.ComponentModel.Container components = null;
public Form1()
{
InitializeComponent();
}
public Form1(HttpServiceWatcher serviceWatcher) : this()
{...
The AddComponent method on the IWindsorContainer interface has several overloads, for example:
WindsorContainer.AddComponent<I,T>()
and
WindsorContainer.AddComponent<I,T>(string key)
What's the use of the key parameter and why should I use it?
...
For example I have two interfaces: ICustomerService and IOrderService which each has a couple of functions like GetCustomer, GetOrder, etc.
I want one class to implement both interfaces: Server.
How does Castle Windsor respond to this?
Is it possible in the first place?
When I resolve the Server object based on one of the two interfac...
I noticed that the castle windsor fluent component registration interface has the rather confusing ActAs() method.
Googling around for it the only reference I found was at their wiki here.
TODO (Stuff that could be documented)
what does ActAs() do?
Not too helpful.
The source doesn't seem to have any unit tests for the...
I am using windsor castle as my IoC container, and has run in to a bit of a problem. This is best explained in code, so I´ll give it a try.
I have a factory class, that should provide me with implementations of a certain interface:
public interface IObjectCreatorFactory
{
IObjectCreator GetObjectCreator(Type objectType);
}
public in...
I am fairly new at using the ASP.NET MVC framework and was hoping that I could find some help about best-practises when caching various parts of my MVC web application. I know that stack overflow uses MVC and some pretty freeking awesome caching techniques, and its MILES faster than my app, even when running locally.
I have a few quest...
I'm following the Windsor Inversion of Control (IoC) Getting Started example, which is in C#, but I'm implementing it in VB.Net, and I've run into a small problem..
Here's the exception I'm getting in full:
Can't create component 'form.component' as it has dependencies to be satisfied.
form.component is waiting for the following ...
Having seen how NInject can do it and AutoFac can do it I'm trying to figure out how to inject dependencies into MVC ActionFilters using Castle Windsor
At the moment I'm using an ugly static IoC helper class to resolve dependencies from the constructor code like this:
public class MyFilterAttribute : ActionFilterAttribute
{
priva...
I am looking for some info on using and configuring windsor to provide a dynamic proxy to intercept calls to an instance of another class.
My class represents a resource that should be retained as a long lived instance by the container for performance reasons. However, sometimes this resource can transition into ununusable state, and...
Im looking to handle authorization in an MVC app through the use of a Windsor IInterceptor - because this seems like the only way I can get named access to parameters the action is passed which are relevant for determining if the user has access.
From my Intercept method I need access to the action that is called.
I figured out how to ...
Using Castle Windsor, I have a component configured with the transient lifestyle:
<component id="publish.mapping.default"
service="IMyService, MyAssembly"
type="MyServiceImplementation, Myassembly"
lifestyle="transient" />
Which will be used like this:
var service = container.Resolve<IMyService>(componentId);
//...
I am using a netdatacontractserializer and a SerializationBinder to create my own runtime types for nhibernate proxies on the client side.
This all works except I am forced to assume that there is only one type by each name in the domain model. i.e. i am forced to ignore the namespace. The reason is that SerializationBinder only gives m...
When resolving a component which the Windsor container cannot find, an exception is thrown.
StructureMap has a TryGetInstance method, which returns null of it can't find the requested component.
Does Castle Windsor has something like this? Or am I forced to catch these exceptions (I don't like that, because of the performance overhead ...
i am using third party library where i need to pass in array of empty assembly. the constructor of the class is:
MyService(IEnumerable<Assembly> assemblies)
{}
in my case the list will be empty. i tried the following with empty value but
<component id="service" type="MyService, S"
service="IMyService, S">
<parameter...