container.Register(Component.For<
IMyComponent>().ImplementedBy<MyComponent>().Configure(registration
=>
registration.Parameters(Parameter.ForKey("start_at").Eq("1"))
)
);

On Wed, Sep 24, 2008 at 1:45 AM, George Mauer <[EMAIL PROTECTED]> wrote:

>
> I tried to get an <a href="http://stackoverflow.com/questions/87812/
> castle-windsor-how-to-specify-a-constructor-paramter-from-code<http://stackoverflow.com/questions/87812/castle-windsor-how-to-specify-a-constructor-paramter-from-code>
> ">answer
> to this on Stack Overflow</a> but the answers supplied came up short
> so I'm going to the source.
>
> Say I have the following class
>
> MyComponent : IMyComponent {
>  public MyComponent(int start_at, IDependency other_component) {...}
> }
> I can register an instance of it with castle windsor via xml as
> follows
> <component id="other"  service="NS.IDependency, WindsorSample"
> type="NS.DependencyComponent, WindsorSample" />
> <component id="sample"  service="NS.IMyComponent, WindsorSample"
> type="NS.MyComponent, WindsorSample">
>  <parameters>
>    <start_at>1</start_at >
>  </parameters>
> </component>
> How would I go about doing the exact same thing but in code? (Notice,
> the constructor parameter)
>
> I am just using this for integration tests so using Binsor or Xml is
> not particularly helpful.  Also, as much as I would like to use fluent
> interfaces, compiling source using NAnt (which I would have to learn)
> seems like a bit much just to get this functionality.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to