Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a project that has a domain specific language (Microsoft.VisualStudio.Modelling) that uses the modelling SDK.

In that model I want my model shape to perform a function on the underlying class e.g. my diagram model is like:-

C#
using DslModeling = global::Microsoft.VisualStudio.Modeling;
using DslDesign = global::Microsoft.VisualStudio.Modeling.Design;
using DslDiagrams = global::Microsoft.VisualStudio.Modeling.Diagrams;

public abstract partial class EventDefinitionCompartmentShapeBase : DslDiagrams::CompartmentShape
    {
       // auto code generated stuff
    }


This compartment shape is based off a domain class:-

C#
public partial class EventDefinition : DslModeling::ModelElement
    {
    }


How would I get the instance of that class being modelled by the compartment shape code from within that compartment shape code?
Posted

1 solution

Aha - it turns out that "BaseClass" is no longer a member of CompartmentShape in Visual Studio 2015.

Instead you can use "ModeElement" thus:-

SQL
EventDefinition BaseClass
{
    get
    {
        return this.ModelElement as EventDefinition;
    }
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900