***Disclaimer: This information applies to Visual Studio 2010 Beta 1 only.***
This time I will talk about the new DSL extensibility feature in DSL VS10. This feature allows a model to be extended after it is deployed. This opens a huge number of possible scenarios including third party ones.
In this part I will cover the core changes and concepts in the new version of DSL to support the extensibility feature.
A DSL extension is indeed another DSL. This means that a DSL is extended by creating another DSL.
From now on I will refer to them as the extendee DSL and extension DSL respectively.
These are just a couple of extensibility points that can be provided (just to mention some of them):
- Add new domain classes / domain relationships
- Add new extension elements to existing model elements
- Add new commands
- Add modeling rules
But the real thing is that we can completely override the behavior of the extendee DSL. What really happen behind the scenes is that the extendee domain model plus all the extension domain models found are being loaded into the same store.
The new ExtensionElement domain class
In the runtime there is a new abstract class called “ExtensionElement” that inherits from the well known ModelElement. This class is used to represent an extension to a model element. It also called “MEX”.
The new “Extensions” domain relationship
The ModelElement was updated and now includes a new “Extensions” domain property. This is basically an embedding relationship between ModelElement and ExtensionElement.
MEX extension methods
Under the new Microsoft.VisualStudio.Modeling.Extensibility namespace, there are a couple of useful extension methods for the ModelElement class to do CRUD operation over the ModelElement extensions.
Next part : MEF, extension providers and how extension domain models are being injected