Code based installer version of <parameters>?

12 views
Skip to first unread message

Scott_M

unread,
Jan 15, 2013, 10:41:07 PM1/15/13
to castle-pro...@googlegroups.com
I am trying to take an existing XML based component registration and write an equivalent code based installer.  The xml registration looks something like this:

<component id="HorizontalLogEntryFormatter" lifestyle="transient" service="Acme.Kernel.Logging.Int.IHorizontalLogEntryFormatter, Acme.Kernel.Logging.Int" type="Acme.Kernel.Logging.Impl.HorizontalLogEntryFormatter, Acme.Kernel.Logging.Impl">
        <parameters>
          <dateTimeFormat>MM/dd/yyyy hh:mm:ss K</dateTimeFormat>
        </parameters>
      </component>

How do you write this registration in c# code (specifically, the dateTimeFormat parameters)?




Krzysztof Kozmic

unread,
Jan 15, 2013, 10:51:10 PM1/15/13
to castle-pro...@googlegroups.com
.DependsOn(Dependency.OnParameter("dateTimeFormat", "MM/dd/yyyy hh:mm:ss K"))

-- 
Krzysztof Kozmic

--
You received this message because you are subscribed to the Google Groups "Castle Project Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/castle-project-users/-/SLuR2iBU1okJ.
To post to this group, send email to castle-pro...@googlegroups.com.
To unsubscribe from this group, send email to castle-project-u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en.

Scott_M

unread,
Jan 15, 2013, 10:53:46 PM1/15/13
to castle-pro...@googlegroups.com
Thanks Krzysztof!



scott
To unsubscribe from this group, send email to castle-project-users+unsub...@googlegroups.com.

Krzysztof Kozmic

unread,
Jan 15, 2013, 10:55:29 PM1/15/13
to castle-pro...@googlegroups.com
cheers

If you need more details have a look at the docs: http://docs.castleproject.org/Windsor.Inline-Dependencies.ashx

and feel free to update them if something is not clear or missing :)

-- 
Krzysztof Kozmic


To post to this group, send email to castle-pro...@googlegroups.com.
To unsubscribe from this group, send email to castle-project-u...@googlegroups.com.

Scott_M

unread,
Jan 15, 2013, 11:04:35 PM1/15/13
to castle-pro...@googlegroups.com
One slight problem...with Dependency.OnParameter (unrecognized... I am using Windsor 3.1.  Is this a 3.2 construct?).   Changed it slightly:

container.Register
                (
                Component.For<IHorizontalLogEntryFormatter>()
                         .ImplementedBy<HorizontalLogEntryFormatter>()
                         .LifeStyle.Transient
                         .DependsOn(
                            Property.ForKey("dateTimeFormat").Eq("MM/dd/yyyy hh:mm:ss K");
                         
                );


On Tuesday, January 15, 2013 9:51:10 PM UTC-6, Krzysztof Koźmic wrote:
To unsubscribe from this group, send email to castle-project-users+unsub...@googlegroups.com.

Krzysztof Kozmic

unread,
Jan 15, 2013, 11:06:28 PM1/15/13
to castle-pro...@googlegroups.com
it's there in 3.1. I was writing it from memory so I may have it slightly wrong but there should be Dependency.OnSomething() method for this.

It's there to replace zoo the Property.ForKey, ServiceOverride.ForKey etc and bring them all under a single roof

-- 
Krzysztof Kozmic


To post to this group, send email to castle-pro...@googlegroups.com.
To unsubscribe from this group, send email to castle-project-u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages