castle-windsor

Problem with initializing a type with WinsdorContainer

public ApplicationView(string[] args) { InitializeComponent(); string configFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "log4net.config"); FileInfo configFileInfo = new FileInfo(configFilePath); XmlConfigurator.ConfigureAndWatch(configFileInfo); IConfigurationSource con...

Collection of dependencies in castle windsor

I have the following scenario: public class FirstChildService : IChildService { } public class SecondChildService : IChildService { } public class MyService : IService { public MyService(IEnumerable<IChildService> childServices){ ... } } I'm currently registering all the child services and explicitly depending on them in the cons...

Where is Castle Windsor FromAssembly class located?

As you can see in Windsor wiki There is a class named FromAssembly to help me with installers. But i'm unable to find it anywhere in Castle.* I'm using .NET 4 ...

How to make Castle windsor resolve generics with constraints?

using System; using Castle.Windsor; using Castle.MicroKernel.Registration; using System.Reflection; using Castle.MicroKernel.Resolvers.SpecializedResolvers; namespace Windsor { class MainClass { public static void Main (string[] args) { var container = new WindsorContainer (); container.R...

Castle Windsor to create instance of object based on URL parameters?

Is it possible for me to get Castle Windsor to inject an object that has been created with URL parameters? Either as query string parameters or parameters defined in a routing configuration? Currently this object is being passed in to the Controller's Index action method, but I need to have it available in the constructor. If so, what ...

Where do you download NHibernate Castle Facility?

I know it seems like a silly question, but its not clear from the castle project page/documentation. I would need a version compatible with the latest version of NHibernate (2.1.2). Should I get the latest source from the github trunk and build it, or is there another place I should get it from? ...

Dependency Injection and loading dependent assembly in .NET

I'm working with dependency injection (DI from now on) to resolve components and am looking for an elegant solution to loading dependent assemblies in a .NET environment. As an explanation, lets say that we have 3 assemblies, A, B and C, where A depends on B and B depends on C. Now I need to load components from assembly A, but because I...

Logging in Windsor

I'm trying to figure out how to setup logging in Castle Windsor. I cannot find anywhere how to do this. I have the following code for setting up logging: public class Installer : IWindsorInstaller { public void Install(IWindsorContainer container, IConfigurationStore store) { InstallLog(container); } private voi...

Castle Windsor RemoveComponent False

I am calling Kernel.RemoveComponent on my Windsor container and it is returning false. I know the component is present (I have verified by calling GetHandler with the same key and it returns the expected info)...so why can't I remove my component from the container? How can I troubleshoot this? I have a bunch of authentication and autho...

ILMerge and Castle.Core Exclusion

Does anyone know why the Castle.Core assembly has to be excluded from the IlMerge process? I've seen a lot of open source projects with IlMerge.exclude files that lists the following files to be excluded from the merge. Castle.Core.Interceptor.IInvocation Castle.Core.Interceptor.IInterceptor Castle.Core.Interceptor.IProxyTargetAccessor...

Is it ok to register components in Windsor without specifying an interface?

Is it considered bad form to register components in Windsor without specifying an interface? i.e. container.Register(Component.For().LifeStyle.Transient); as opposed to... container.Register(Component.For().ImplementedBy().LifeStyle.Transient); I understand the benefits of coding to an interface rather than a concrete implementation ...

Using Moq with Windsor -- Object of Type Moq.Mock[IFoo] cannot be converted to IFoo

I'm trying to set up some Moq repositories to test my service with Castle Windsor as my IOC. Mu service depends on IFoo, so I'm creating a moq instance that implements IFoo and injecting it into the container like so: _container.AddComponent("AutoBill", typeof (AutoBillService), typeof (AutoBillService)); var mockUserRepository = n...

Why wont my custom role provider update the roles when I change the database?

I am building a small CMS system with ASP.NET MVC and I have a custom role provider using a userRepository instantiated by a factory implemented using Castle Windsor. Someone with admin privileges can change the roles of a user, saved in a database, using the back-end administration. But whenever I log onto the user for whom I just c...

Resolve parameters with a custom class

I have a Domain Specific Language, and I would like to register objects that can be instantiated inside. For instance a class that can do httprequests. [IoC("HttpRequest", typeof(DslScriptObject), IoCAttribute.IoCLifestyleType.Transient)] internal class WebRequestDslObj : DslScriptObject { [DslNew] public WebRequestDslObj() : t...

Unit Test passes in Visual Studio but fails on the command line (cant find Castle.Core)

Hi, I have a weird issue. My unit test passes in the IDE but fails in the command line (usually I'd expect it the other way around). I'm using Visual Studio Team System 2008, and .net 3.5. I have a 'soft' dependency in my project on NHibernate (NHibernate.ByteCode.Castle.dll) and on Castle (Castle.DynamicProxy2.dll). I've setup the t...

Register multiple interceptors in castle windsor fluent

How do I register multiple interceptors using the fluent API? ...

Castle Windsor Transient Lifestyle Not Activating

Hi, I'm having a problem with a component in my container with a Transient lifestyle. The first time I call resolve, I hit the constructor of the implementation type as expected. However, the second time I call resolve, a new instance is not constructed. Rather, the existing instance is reused. I don't think this should happen, since ...

Implement Interface Without Creating Implementation (Dynamic Proxies?)

I've been working on creating my own IoC container for learning purposes. After asking a couple questions about them, I was shown that creating a factory to "resolve" the objects was the best solution (see third solution here). User Krzysztof Koźmic showed that Castle Windsor actually can implement this for you. I've been reading the so...

Create a ISubDependencyResolver that looks at property/parameter attributes

Hi, I'm using Castle Windsor as part of a more specialized framework. One of the requirement that popped up is to be able to select the implementations to use when resolving a service based on attributes specified on the service. For example, let say: public class MyService { public MyService([Selector("Bar")]SomeDependency foo){.....

Overridding GetHashCode and Equals in Castle Dynamic Proxy 2.1 IModelInterceptorsSelector

I've read that in order to get caching and push performance when using an Interceptor Selector when using Castle Dynamic Proxy that I need to override GetType(), GetHashCode() and Equals() Where can I find an example of or what would be the best, from a performing perspective, implementation? ...