just reviving a bit this over-the-weekend-post - maybe somebody could help
me out here...

On Fri, Mar 5, 2010 at 5:41 PM, Jan Limpens <[email protected]> wrote:

> The blog post I refer to is
> http://hammett.castleproject.org/?p=159
>
> and it seems i don't have o re-register my controller to the container.
> Still I cannot register my views, so my question still stands...
>
>
> On Fri, Mar 5, 2010 at 5:21 PM, Jan Limpens <[email protected]> wrote:
>
>> I want to be able to register controllers in a plug in fashion - so they
>> need to have their view files as embedded resources.
>>
>> Like hammett suggested it (in 2007) in this blog entry, I try to get to
>> the IViewSourceLoader(s) on first request (hackety-hack).
>> But my container always return null for that service, so I wonder if
>> things might have changed - for the better maybe...
>>
>> My code:
>>
>> private static void
>> addConfiguredControllersFromWebConfig(IWindsorContainer container)
>>         {
>>
>>             var config = ConfigurationManager.GetSection("adminConfig") as
>> AdminConfigSection;
>>             if (config == null)
>>                 return;
>>
>>             var tree = container.GetService<IControllerTree>();
>>             var loaders = container.ResolveAll<IViewSourceLoader>(); //
>> getting null here
>>
>>             if (tree==null || loaders==null)
>>                 return;
>>
>>             foreach (TypeConfigElement elm in config.Controllers)
>>             {
>>                 var controllerName = elm.Type.Name.Replace("Controller",
>> string.Empty);
>>                 tree.AddController(string.Empty, controllerName,
>> elm.Type);
>>                 container
>>                     .Register(Component.For(elm.Type)
>>                     .Named(controllerName)
>>                     .LifeStyle.Transient);
>>
>>                 foreach (var loader in loaders)
>>                 {
>>                     var ns = elm.Type.Namespace.Replace(".Controllers",
>> ".Views");
>>                     var info = new AssemblySourceInfo(elm.Type.Assembly,
>> ns);
>>                     loader.AddAssemblySource(info);
>>                 }
>>             }
>>         }
>>
>> any idea. also hint of how to do this with less code would be welcome :)
>> --
>> Jan
>>
>
>
>
> --
> Jan
>



-- 
Jan

-- 
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