Lightcore Bootstrapper

Nov 9, 2010 at 9:42 AM

As there is a new lightweight bootstrapper, I'd like to give it a chance. I am looking for a way to integrate it into CM

Nov 9, 2010 at 10:38 PM

Just took the MefBootstrapper example and changed it into

public class LightCoreBootstrapper : Bootstrapper
{
        IContainer _lightCoreContainer;

        protected override void Configure()
        {
            var builder = new ContainerBuilder();

            builder.Register<IWindowManager,WindowManager>();
            builder.Register<IEventAggregator,EventAggregator>();
            builder.Register<IShell,ShellViewModel>();
            _lightCoreContainer = builder.Build();
        }


        protected override object GetInstance(Type service, string key)
        {
            return string.IsNullOrWhiteSpace(key) ? _lightCoreContainer.Resolve(service) : null; 
        }


        protected override IEnumerableGetAllInstances(Type service) 
        { 
             return _lightCoreContainer.ResolveAll().Where(c =>c.GetType()==service); 
        } 
} 

I know it is not perfect, but it ran right from the start... strange.