XML Extension and Weak Event Message Broker Extension

May 10, 2012 at 3:47 PM

I am newbie in Ninject and IoC and I want to understand how to use it
I need to use XML configuration for creating my objects (this is a
requirement) and I done that. But I need to use WeakEventMessageBrorker
too. So when create objects by the code (not with XML config file) the
events are wired together and everything works perfect. When create
objects and load XML file the events are not wired.
My xml file looks like basic.xml from the Ninject.Extension.Xml.Test

<module name="basicTest">
    <bind name="myObject"
                service="MyNamespace.IService, MyProjectName"
                to="MyNamespace.MyService, MyProjectName" />

, and class form code behind

public override void Load()


So what is the difference from both object created by xml config file
and from code behind?
I know that Ninject`s goal is to restrict using of xml, but is there
any chance to use  Ninject.Extension.Xml and WeakEventMessageBrorker
Thanks in advance

May 11, 2012 at 1:59 PM
Edited May 11, 2012 at 2:00 PM

Hello all,

I figure out what was the problem. The few examples with XML Extensions are very shorts and they are saying:

 var settings = new NinjectSettings { LoadExtensions = false };
 kernel = new StandardKernel(settings, new XmlExtensionModule());
But LoadExtensions = false exclude auto loading of available modules.
So I changed it to:
 kernel = new StandardKernel();
And it works perfect - it loads WeakEventMessageBroker Extension, and XML extension too and events are wired up.