Ah - now all is clear! Thanks for the info - I'll try to codify it in the docs next.
Cheers, Symon. Symon Rottem http://blog.symbiotic-development.com On Sat, Jul 31, 2010 at 10:35 PM, Mauricio Scheffer < [email protected]> wrote: > Yes, it's strictly limited to that enum, but AFAICT you can pass any > number of Custom services. This isn't like Windsor's component names > which are supposed to be unique. This id is only a friendly > convenience thing so that the user doesn't have to remember/know about > the particular interfaces. The id is only used to infer the interface. > > -- > Mauricio > > On Sat, Jul 31, 2010 at 4:59 PM, Symon Rottem <[email protected]> wrote: > > Thanks Mauricio - very detailed response. > > I'm getting there... > > I've found the method that registers the service overrides > > (RegisterServiceOverrideFromConfigurationNode); from looking at the > source I > > guess that the id attribute values are strictly limited (as per the XML > > sample in the docs) to the values in the enum ServiceIdentification. > > I assume you can't provide a value like "MyService" since the Enum.Parse > > would throw an exception. If you specify "Custom" then there could only > one > > custom service which defines a type and interface for that service but no > > second custom service could be registered...so I still don't really > > understand the reasoning behind the "Custom" id feature. > > Apologies for the continued questions! > > Cheers, > > Symon. > > Symon Rottem > > http://blog.symbiotic-development.com > > > > > > On Sat, Jul 31, 2010 at 7:57 PM, Mauricio Scheffer > > <[email protected]> wrote: > >> > >> Here's what I make from the source code (inline): > >> > >> On Sat, Jul 31, 2010 at 6:59 AM, Symon Rottem <[email protected]> > wrote: > >> > Thanks Mauricio, > >> > I think I understand the basic principles at work here, but I want to > be > >> > sure I'm clear before attempting to document it. Where I'm a bit > stumped > >> > is > >> > what is involved in overriding the services using the XML: > >> > > >> > Is the value id attribute restricted to the list provided? If another > >> > value > >> > is provided is it considered an error? > >> > >> Yes, it's an error. It will throw a MonoRailException. > >> > >> > If the id attribute value is "Custom" what does that mean? > >> > >> It will add the service as defined in the node. In this case, the > >> service attribute id mandatory. If it matches one of MonoRail's > >> service interfaces it will override it. Otherwise it will just add the > >> service to the container as is. > >> > >> > >> > I assume that the type specified in the type attribute would be the > new > >> > type > >> > to register under the existing id which would replace the default > >> > implementation of the service - is that correct? > >> > >> yes. > >> > >> > I gather that the interface attribute is optional but if included the > >> > value > >> > would need an interface that is implemented by the new type specified > in > >> > the > >> > type attribute - is that correct? > >> > >> Yes. > >> > >> > If the interface attribute is present is it restricted to the existing > >> > interface that corresponds to the default service that's being > >> > overridden? > >> > >> If the id is "Custom" the interface and type can be anything (as long > >> as the type implements the interface, of course). > >> If the id is one of Monorail's services, the interface is inferred > >> from the id. If you define both a non-custom id and an interface, and > >> the interface doesn't match the expected monorail service interface, > >> it will probably crash with an InvalidCastException or something. > >> > >> > One more thing; can services be overridden programatically? > >> > >> Yes. IMonoRailServices (= IMonoRailContainer) has setters for all > >> services. IMonoRailContainer can be accessed at startup by making your > >> HttpApplication implement IMonoRailContainerEvents. See > >> > >> > http://blog.andreloker.de/post/2008/05/06/Access-to-MonoRail-service-instances.aspx > >> > >> Cheers, > >> Mauricio > >> > >> > Cheers, > >> > Symon. > >> > Symon Rottem > >> > http://blog.symbiotic-development.com > >> > > >> > > >> > On Sat, Jul 31, 2010 at 12:45 AM, Mauricio Scheffer > >> > <[email protected]> wrote: > >> >> > >> >> It allows the user to override the built-in MonoRail services > >> >> (ControllerFactory, EmailSender, etc). A complete list of available > >> >> services to override and service node structure is here: > >> >> > >> >> > >> >> > http://www.castleproject.org/monorail/documentation/trunk/manual/configurationref.html#ConfigExplained > >> >> . > >> >> > >> >> Also see > >> >> > >> >> > http://www.castleproject.org/monorail/documentation/trunk/advanced/services.html > >> >> > >> >> A list of default implementations for these services is in > >> >> DefaultMonoRailContainer.InstallMissingServices(): > >> >> > >> >> > >> >> > http://github.com/castleproject/Castle.MonoRail/blob/master/src/Castle.MonoRail.Framework/Container/DefaultMonoRailContainer.cs#L414 > >> >> > >> >> This acts as a basic internal service locator. For example you could > >> >> override the default cache provider with a memcached provider. > >> >> > >> >> > >> >> On Fri, Jul 30, 2010 at 7:18 PM, Symon Rottem <[email protected]> > >> >> wrote: > >> >> > Hi Guys, > >> >> > I'm working up expanded documentation for MonoRail and while > working > >> >> > my > >> >> > way > >> >> > through the Configuration section I find that I'm stumped by the > >> >> > services > >> >> > node, what it's really for and how it works. I've had a read > through > >> >> > the > >> >> > services section of the existing documentation fear I am little > wiser > >> >> > for my > >> >> > efforts. > >> >> > Is there anyone out there who can explain what services are for, > why > >> >> > one > >> >> > would choose to put something into the <services> node in the > >> >> > MonoRail > >> >> > configuration and what a <service> node is comprised of? If > someone > >> >> > can > >> >> > explain it I can add it to the docs. > >> >> > Cheers, > >> >> > Symon. > >> >> > Symon Rottem > >> >> > http://blog.symbiotic-development.com > >> >> > > >> >> > -- > >> >> > You received this message because you are subscribed to the Google > >> >> > Groups > >> >> > "Castle Project Development List" group. > >> >> > To post to this group, send email to > >> >> > [email protected]. > >> >> > To unsubscribe from this group, send email to > >> >> > [email protected]<castle-project-devel%[email protected]> > . > >> >> > For more options, visit this group at > >> >> > http://groups.google.com/group/castle-project-devel?hl=en. > >> >> > > >> >> > >> >> -- > >> >> You received this message because you are subscribed to the Google > >> >> Groups > >> >> "Castle Project Development List" group. > >> >> To post to this group, send email to > >> >> [email protected]. > >> >> To unsubscribe from this group, send email to > >> >> [email protected]<castle-project-devel%[email protected]> > . > >> >> For more options, visit this group at > >> >> http://groups.google.com/group/castle-project-devel?hl=en. > >> >> > >> > > >> > -- > >> > You received this message because you are subscribed to the Google > >> > Groups > >> > "Castle Project Development List" group. > >> > To post to this group, send email to > >> > [email protected]. > >> > To unsubscribe from this group, send email to > >> > [email protected]<castle-project-devel%[email protected]> > . > >> > For more options, visit this group at > >> > http://groups.google.com/group/castle-project-devel?hl=en. > >> > > >> > >> -- > >> You received this message because you are subscribed to the Google > Groups > >> "Castle Project Development List" group. > >> To post to this group, send email to > >> [email protected]. > >> To unsubscribe from this group, send email to > >> [email protected]<castle-project-devel%[email protected]> > . > >> For more options, visit this group at > >> http://groups.google.com/group/castle-project-devel?hl=en. > >> > > > > -- > > You received this message because you are subscribed to the Google Groups > > "Castle Project Development List" group. > > To post to this group, send email to > [email protected]. > > To unsubscribe from this group, send email to > > [email protected]<castle-project-devel%[email protected]> > . > > For more options, visit this group at > > http://groups.google.com/group/castle-project-devel?hl=en. > > > > -- > You received this message because you are subscribed to the Google Groups > "Castle Project Development List" group. > To post to this group, send email to [email protected] > . > To unsubscribe from this group, send email to > [email protected]<castle-project-devel%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/castle-project-devel?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Castle Project Development List" 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-devel?hl=en.
