从CompartmentShape获取它正在建模的基础类 [英] Get from a CompartmentShape to the underlying class it is modelling

查看:50
本文介绍了从CompartmentShape获取它正在建模的基础类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目,其中包含使用建模SDK的特定于域的语言(Microsoft.VisualStudio.Modelling)。



在该模型中,我希望我的模型形状在底层类上执行一个函数,例如我的图表模型如下: -



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:-

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:-

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?

推荐答案

Aha - 事实证明BaseClass不再是Visual Studio 2015中CompartmentShape的成员。 />


相反,您可以使用ModeElement: -



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

Instead you can use "ModeElement" thus:-

EventDefinition BaseClass
{
    get
    {
        return this.ModelElement as EventDefinition;
    }
}


这篇关于从CompartmentShape获取它正在建模的基础类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆