That should work in theory. I'll take a look at whats going on. Can you try installing the configuration first?
2009/9/23 Krzysztof Koźmic <[email protected]> > Craig, > > I would strongly prefer xml over Binsor... mostly because the admin is > familiar with xml, plus I don't want to drag bisor + all the boo assemblies > for just that. > > I actually tried the second option (only specifying component it) but it > does not get picked up, and I get error that component is waiting for > dependencies: > > here's my code: > > namespace WindsorXmlTests > { > using System; > using Castle.Windsor; > using Castle.Windsor.Installer; > > class Program > { > static void Main(string[] args) > { > IWindsorContainer container = new WindsorContainer(). > AddComponent<IMyComponent, MyComponent>("foo"). > Install(Configuration.FromXmlFile("Config.admin")); > var component = container.GetService<IMyComponent>(); > component.Print(); > Console.ReadKey(true); > } > } > > public interface IMyComponent > { > void Print(); > } > > class MyComponent : IMyComponent > { > private readonly string name; > > public MyComponent(string name) > { > this.name = name; > } > > public void Print() > { > Console.WriteLine(string.Format("Hello, {0}", name)); > } > } > } > > and the Config.admin file: > > <?xml version="1.0" encoding="utf-8" ?> > <configuration> > <components> > <component id="foo"> > <parameters> > <name>Krzysztof</name> > </parameters> > </component> > </components> > </configuration> > > Do you see any stupid mistake I made here? > > Krzysztof > > > Craig Neuwirt wrote: > > 2 things come to mind > > - Binsor => Ayende added some extension capabilities to extend > components, however it is limited in what it can do > - The Configuration.FromXmlFile that Henry mentioned was added for that > purpose. If you know the component id, you should be able to add > something > like > > <component id="my_component> > <parameters> > <someting>11</something> > </parameters> > </component> > > 2009/9/23 Krzysztof Koźmic <[email protected]> > >> >> My goal is to have the following: >> >> - register all the components in the code >> - externalize some of configuration options (like addresses and ports,) >> to external config file that a non-programming admin would edit. >> - be able to specify defaults for these options in code, and override >> these from the config if present >> >> The major point is to have just the minimal necessary amount of stuff >> put in the config file, to keep it clean, minimal and as readable as >> possible - something like: http://gist.github.com/191862 >> >> Now, Henry pointed me to Configuration.FromXmlFile method, but it seems >> to be working with the full blown windsor config files only, which I >> want to avoid, if only to make sure admin can't screw my component >> registration. >> >> Do we have some way of doing this baked in? If no, would you see it >> beneficial to have that in the framework? >> >> Krzysztof >> >> >> > > > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
