This project has moved. For the latest updates, please go here.

Architecture questions

Nov 12, 2009 at 9:10 AM


I'm working with VS 2008, and building a MEF project with the library System.ComponenetModel.Composition v 2009.1.23.0.

First example I've made runs well, but before to take a new start for bigger application, I'm in trouble to select the right architecture.

Lets take a simple example.

- a contract project which propose two interface : ISupplyCustomer, IDrawMenu.

- a project which contains two winforms :

    * The first one (like frmCustomerSelectionList) implements and exports ISupplyCustomer

    * The second one (like frmNewOrder) implements IDrawMenu, imports ISupplyCustomer and exports IDrawmenu

- a main project which contains two winforms :

    * The first one (like frmMDI) imports IDrawMenu

    * The second one (like frmSplash)

Two questions :

1. How to organize code to make only one entire composition of import / export for the whole application. So objects will only use imports and not creates batch every time they need to import. Create public static variables in Program.cs, I think it works but I'm sure this is not the better way. What is the best ?

2. Can object exports Metadata if they don't export any interface ? I want my splash form to compose the whole batch composition, and fill a list of the whole metadata of my solution. Have I to create a fake interface, like ISplash, which every class I want to export metadata will implement ? Once again, what is the best ?