Pablo Galiano : DSL / VS 10 ModelBus part 2

Subscriptions

<September 2010>
SuMoTuWeThFrSa
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789

News

Subscribe to Pablo Galiano by Email

Post Categories

DSL / VS 10 ModelBus part 2

***Disclaimer: This information applies to Visual Studio 2010 Beta 1 only.***

 

In the first part of this series I described general concepts around the ModelBus infrastructure. In this second part I will describe the model bus service and how MEF is involved.

The ModelBus as a Service

The Microsoft.VisualStudio.Modeling.Sdk.Integration.Shell.10.0 is a VS Package that defines one core service, the IModelBus service.

The model bus service creates and uses its own MEF composition container with two directory catalogs pointing to:

  • %LocalAppData%\Microsoft\VisualStudio\10.0\Extensions
  • %VS10_Install_Dir%\Extensions

 

A DSL exports an adapter manager and provides some metadata to specify which adapter this manager manages:

[Export(typeof(ModelBusAdapterManager))]

[HandlesAdapter(“MyAdapterId”)]
public partial class MyAdapterManager : VsModelingAdapterManager
{


}

 

The main responsibility of the model bus is to find registered adapter managers, for that the composition container is used:

container.GetExportedObjects<ModelBusAdapterManager>()

 

In order to register a DSL with the model bus we need to do the following steps:

  • Update the model definition to introduce a domain property that will hold the model reference
  • Update the model serialization behavior to include the model reference serialization
  • Create an adapter for the DSL
  • Create an export an adapter manager for the DSL
  • Deploy the DSL under extensions (done automatically at compilation time via the VS SDK msbuild target)

 

Stay tuned,

Pablo

posted on Tuesday, July 14, 2009 5:53 AM by pga