Odeslat dotazOdeslat dotaz
 

DotazDo MEF support WPF elements composition?

  • 11. června 2009 21:02Riana Rambonimanana Uživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaile
     
    Hi,


    I discovered MEF one hour ago and it seems that this Framework interest me a lot to program a plugin based application.
    However, I have some questions about it and I will be really glad if someone, who knows MEF, give me some answers.

    1- Do each Plugin or Part can be configurable independently ?  I mean, is it possible to associate an "App.Config" file for each Plugin so that each one can be configurable independently ?
    2- Do MEF allow WPF controls composition ? Suppose I have a plugin A and a plugin B. In each one I have a WPF component, a Panel in the plugin A and a Button in plugin B. I'd like to know if my Button in the plugin B can be added to my Panel in plugin A. In fact, I'd like to reproduce the Composite Application Library behavior with MEF. Is that possible?

    Thanks

    Riana

Všechny reakce

  • 11. června 2009 21:51Riana Rambonimanana Uživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaile
     
    After taking a look more closely, it seems that my question number 2 is satisfiable and, the sample codes use it. It is totally possible to declare Shell container and use MEF to insert Chidren to the shell container.

    About my question number 1, it seems that it is not possible unfortunately ...
    The all application is always executed in the default app domain so,  only one configuration file can be used for all classes and components of the application.
    It seems that it is not possible to have some kind of configurable  "Modules". I mean by "Modules" an aggregation of classes or assemblys that are logically tied together. Each Module should be configurable with one configuration file,  and can interact with other Modules of the application. Also, a module should be dynamically loadable and unloadable...

    Imagine for example an application which can be composed by a  'Communication Module' that should be configurable with an App.config file because it use WCF client, and a "UI Module" that should also have its own configuration file. It seems that this scenario is not possible to realize using MEF ...

    Please tell me if I am right or wrong.

    Regards,

    Riana




  • 22. září 2009 14:42cautionsign Uživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaile
     
    I think you might need MAF (System.Addin namespace) rather than MEF in your situation; MAF load the assembly or add-ins in different App-Domain and you can let your "Modules" have different configuration file.


    Regards,
    cautionsign.
    +_cautionsign+_
  • 25. října 2009 15:28Riana Rambonimanana Uživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaile
     
    Effectively, MAF is suitable for plugin-based application and with MAF, we can load and unload modules dynamically.
    However, composing WPF components or other UI elements, using MAF is a little bit tedious. There is also a real performance problem when for example trying to display a component from Plugin A into the main app.

    Actually, in the world of modular architecture framework, it seems that Microsoft do not have yet a product which can be a real alternative to java frameworks like OSGi implementations (Equinox, Felix etc..).

    Riana