Enumerate types of a specific MEF Export
-
9 апреля 2012 г. 12:22
Thank you for reading this post, I am attempting to create a DSL model that will allow the application developer the ability to choose from a list of known MEF Export Types for a given interface from any Assembly or project item within their solution.
I would like to know how at design time and from within my model, how to enumerate all MEF Exported types within the entire solution (source files/assemblies) that support a specific Interface and from which create a collection of the associated Export Names from these MEF Exports all within my DSL Model.
The end result I am attempting to achieve is that I would have a property on a specific Domain Class that contains a prepopulated list of MEF Export Names for a specific Interface so that a user would choose from this list to identify that a particular Domain Class is referenced to a particular MEF Export Type by its name which will be information that is used by my runtime framework to compose that named Export type at runtime.
So for example I have an Interface called ISomeInterfaceType and within my solution I have two classes defined that support the ISomeInterfaceType interface; one with a MEF Export name of “MyType1” the other with a MEF Export Name of “MyType2”. As the application developer is modeling with my DSL model, and adds a Domain Class that implements this functionality it would contain a dropdown list property they could set which would in this scenario contain two list items, “MyType1”, “MyType2”.
If possible, I would also like to understand how I can have the model instance automatically detect and update any Domain Classes where the respective Export Name is changed/deleted within the solution and have the changes applied to any respective DSL model instance (if possible). If not possible please let me know.
I am new to Visual Studio Integration but do understand the principals of DSL generation. Please let me know if you require addtional information.
Johnny Larue
- Перемещено Blair McGMicrosoft Employee 10 апреля 2012 г. 16:11 This is not really a question about DSL, rather about MEF (From:Visual Studio Visualization & Modeling SDK (DSL Tools))
Все ответы
-
10 апреля 2012 г. 16:25
This is not a question about MEF... as I could be looking say a file that has a specific interface...
Forget about the fact that I am looking for MEF Export names within a given source file or assembly ...
If I re-worded this to ... I would like to dynamically derived some meta data from a Visual Studio solution (say ... a list of classes that contain a specific interface) and to add these to a DropDown that an application developer can choose from.
So ... I am really interested in how to enumerate a bunch of types within a VS project and to learn how and where to incorporate such logic into a DSL model dynamically as Domain properties ...
I am sorry that you do not see the overarching question I have possed ... its nothing to do with MEF.
Please let me know where this question best sits if not within the VS Visuailization & Modeling SDK forum.
Johnny Larue
-
17 апреля 2012 г. 13:24
So far I have not received a ton of community support (possibly due to the fact that a moderator of the Extensibility forum moved this to MEF which it's clearly not a MEF issue) ... that said, for those who may have interest in helping or would like more insight into my progress, please check out this posting ...
http://social.msdn.microsoft.com/Forums/en/vsx/thread/eb555ad9-1252-4f36-bd32-5296de48224f
... although not quite 100% (yet) I am getting pretty close to achieving what it is that I was trying to achieve.
Cheers
Johnny Larue
- Изменено Johnny Larue 17 апреля 2012 г. 13:25
- Изменено Johnny Larue 17 апреля 2012 г. 13:26
- Помечено в качестве ответа Johnny Larue 20 апреля 2012 г. 13:19

