How to specify a public property should not be filled by the container?

175 views
Skip to first unread message

George Mauer

unread,
Oct 7, 2008, 1:00:33 PM10/7/08
to Castle Project Development List
When Instantiating a class, Windsor by default treats all public
properties of the class as optional dependencies and tries to satisfy
them. In my case, this creates a rather complicated circular
dependency which causes my application to hang.

How can I explicitly tell Castle Windsor that it should not be trying
to satisfy a public property (I assign it explicitly at a later date)?
I assume there must be an attribute to that extent. I can't find it
however so if that's the issue, please let me know the appropriate
namespace/assembly.

If there is any way to do this from the calling assembly as opposed to
the one that actually contains the class (such as Xml Configuration or
configuration via code) that would be preferable since the specific
library where this is happening has to date not needed a dependency on
castle.

josh robb

unread,
Oct 8, 2008, 12:46:22 AM10/8/08
to castle-pro...@googlegroups.com
On Wed, Oct 8, 2008 at 5:00 AM, George Mauer <gma...@gmail.com> wrote:
> How can I explicitly tell Castle Windsor that it should not be trying
> to satisfy a public property (I assign it explicitly at a later date)?
> I assume there must be an attribute to that extent. I can't find it
> however so if that's the issue, please let me know the appropriate
> namespace/assembly.

I think your looking for [DoNotWire]

> If there is any way to do this from the calling assembly as opposed to
> the one that actually contains the class (such as Xml Configuration or
> configuration via code) that would be preferable since the specific
> library where this is happening has to date not needed a dependency on
> castle.

Himm... there might be a way of doing this using Craig's registration
stuff/xml but I've never done it that way - I had a quick look and
couldn't figure it out.

Someone else got a cluestick for me?

j.

Craig Neuwirt

unread,
Oct 8, 2008, 8:07:42 AM10/8/08
to castle-pro...@googlegroups.com
No direct support in registration interface for that.  Perhaps you can register a custom inspector to remove those dependencies or register a configuration delegate when using the fluent interface that removes dependency too

Gauthier Segay

unread,
Oct 9, 2008, 6:00:52 PM10/9/08
to Castle Project Development List
If acceptable, see use of [DoNotWire]

http://svn.castleproject.org:8080/svn/castle/trunk/InversionOfControl/Castle.Windsor.Tests/Components/MailServer.cs

this stuff came back once a while when some condition break there ;)

On 8 oct, 14:07, "Craig Neuwirt" <cneuw...@gmail.com> wrote:
> No direct support in registration interface for that.  Perhaps you can
> register a custom inspector to remove those dependencies or register a
> configuration delegate when using the fluent interface that removes
> dependency too
>
Reply all
Reply to author
Forward
0 new messages