castle-windsor

Why does Castle Windsor constructor crash on Windows Server 2003 with a manifest?

As part of getting our application ready for Windows7, we recently added a manifest to our our user interface's exe. It runs ok on Windows7. However, now when I try to run the signed exe on Windows Server 2003, the program crashes during startup. I've looked at the crash dump, and it seems to by failing in the constructor of Castle.Core...

Castle - Using Factory Method and Transient Lifestyle

I have the following code in my application start method along with the code to setup the container and factory support. The factory method seems to only be called once instead of every time the session is needed. _container.Kernel.Register( Component.For<ISession>().LifeStyle.Transient .UsingFactoryMethod(() => { //...

How to specify the namespace only once when using Castle.Windsor?

In the Castle.Windsor demo the configuration file contains <component id="form.component" type="GettingStartedPart1.Form1, GettingStartedPart1" /> Why the namespace GettingStartedPart1 is repeated? Couldn't we write just: <component id="form.component" type="GettingStartedPart1.Form1" /> ? ...

No component for supporting the service after upgrading to NHibernate 2.1

Up until recently I had a working service using NHibernate 2.0. I have upgraded to 2.1, but now try to instantiate the ItemManager: IItemManager manager = Container.Instance.Resolve<IItemManager>(); I get an exception: Castle.MicroKernel.ComponentNotFoundException was unhandled by user code Message="No component for supporting the ...

Can I use Moq with subsonic3?

Hi, I'd like to use a mocking framework as well as an IOC framework with my latest project, based on subsonic 3 (ActiveRecord) and ASP.NET MVC. I'd like to use Moq for mocking and Castle-Windsor for IOC. Anyone got any advice or recommendations based on these choices? Any bumps in the road I should be aware of? Chris ...

Can Castle.Windsor do automatic resolution of concrete types

We are evaluating IoC containers for C# projects, and both Unity and Castle.Windsor are standing out. One thing that I like about Unity (NInject and StructureMap also do this) is that types where it is obvious how to construct them do not have to be registered with the IoC Container. Is there way to do this in Castle.Windsor? Am I bein...

Castle Windsor PerWebRequest LifeStyle and Application_EndRequest

Hi Gang, I'm registering some components related to Linq2Sql using PerWebRequest lifestyle. I see them get created, but they get destroyed before my global's Application_EndRequest method gets called. Is that by design? Does anyone know a work around? I want to call commit on my UnitOfWork object to submitchanges() at the end of e...

Castle ActiveRecord: TransactionScope

Just a quick question about usage of TransactionScope in ActiveRecord. Is this something that is used and works or do people use some other method of handling transactions. I am not familiar, and I am not working with AC but I am thinking about adopting SessionScope and TransactionScope for my project, and was just wondering what people ...

Windsor Fluent Registration - All types in an assembly

I wanted to use the fluent interface in Castle Windsor. Since this isn't available in the "release" binaries for .NET 2.0 I compiled from trunk, which is reported to be fairly stable. I compiled just: Castle.Core.dll Castle.DynamicProxy.dll Castle.MicroKernel.dll Castle.Windsor.dll This should be all that is necessary for what I need...

Windsor castle policy injection tutorial?

I would like to learn more about Windsor castle but it seems that it is overwhelming me a bit. I found a code sample here: http://ayende.com/Blog/archive/2007/03/07/Building-the-Policy-Injection-in-40-Minutes-with-Windsor.aspx. It's interesting indeed but it seems to be using a lot of extra code. I thought the power for policy injection ...

Castle Windsor equivalent of StructureMap ObjectFactory.With<>().GetInstance<>()

With StructureMap one can do a resolution and force the container to use specific dependency instance provided at the time of resolution like so: ObjectFactory.With<ISomeDependency>(someDepedencyInstance).GetInstance<IServiceType>() Provided instance will be used in whole resolution chain, that is not only as a direct dependency of IS...

Migrate from .NET MVC 1 to MVC 2 RC

Hi All, I've migrated a MVC1 project to MVC2 RC, and now the site doesn't work at all. I get the error "Entry point was not found." I migrated the project following this link I'm using Castle Windsor as DI. Here is a part of global.asax.cs public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{...

Castle Windsor or Spring.NET - advantages and disadvantages

Yesterday I was reading some articles in this site while I stumbled on an article about this two new IoC tools. Which one should I learn first? Is there some specification about which one should be used when? ...

Are IoC containers about configuration files?

Recently I developed a performance tester console application, with no UI, with the help of a IoC containter (Castle-Windsor-Microkernel). This library enabled me to let the user choose which test(s) to run, simply by changing the configuration file. Have I realized what IoC containers are about? I'm not sure. Even Joel said here on SO ...

SportStore: WebUI.WindsorControllerFactory.GetControllerInstance(System.Type: no suitable method found to override

Hi there, trying to work my way through Steve Sandersons MVC book - but have hit a brick wall when creating the WindsorControllerFactory. It looks as though the method has changed from MVC1 to MVC2. This is the error I'm getting when trying to compile the project: 'WebUI.WindsorControllerFactory.GetControllerInstance(System.Type: no su...

Choosing the correct constructor using an external configuration file in Windsor?

Hi, I'm new to Windsor, but I'm certain there must be a way to do this... I have a class with three different constructors: public MyClass(string SomeParam) { ... } public MyClass(string AnotherParam, string YetAnother) { ... } public MyClass(string AnotherOne, string YeahIKnow, string AnnoyingExampleParam) { ... } In my external ...

How do I get all the key for the components that are currently register in Castle Windsor?

The main question is in the title but here is the background. Since I pick the lazy way to register my components container.Register( AllTypes.Pick().FromAssembly( typeof (MyModelBinder).Assembly).WithService.FirstInterface() ); Now when I try container.AddComponent<CompositionBinder, CompositionBin...

Castle Windsor - Staging vs Production connectionString parameter for a Component

I've been struggling with this problem, and while something elegant would be preferred any old hack will do at this point :) I have a repository that is registered something like: <castle> <properties> <myConnStr>Data Source=COMPUTERNAME\SQL2008;Initial Catalog=MyDB;Persist Security Info=True;User ID=username;Password=password<...

Injecting Dependencies into Domain Model classes with Nhibernate (ASP.NET MVC + IOC)

I'm building an ASP.NET MVC application that uses a DDD (Domain Driven Design) approach with database access handled by NHibernate. I have domain model class (Administrator) that I want to inject a dependency into via an IOC Container such as Castle Windsor, something like this: public class Administrator { public virtual int Id { g...

Windsor Method interception (AOP)

Hi there guys, I'm trying to create interceptors for specific methods but I'm having a hard time. I can't bind an aspect to a specific method. I create the faicilities most of examples show but it still doesn't work. Can anyone give me an example of how to do this? I prefer xml conifguration, if possible. Another question, I have this ...