How to implement Rules in DSL

Hi,

Can anybody please give me Sample Code/Example to implement Rules in DSL.

We want to implement Rules for connectors.

Any directions for above problem will be helpful.

Thanx in advance.

Regards
Kiran Kirdat










Answer this question

How to implement Rules in DSL

  • nelusan

    Kiran,

    The VS SDK ships with some DSL samples that demonstrate using rules. Have a look at the "Example.DSLCustomizations" sample, the default location of which is "C:\Program Files\Visual Studio 2005 SDK\2006.02\VisualStudioIntegration\Samples\DSLTools\".

    In summary, there are three things you need to do:

    1) Write a new rule class that inherits from one of the rule base classes (e.g. AddRule, ChangeRule, RemoveRule etc) and override the appropriate method on the class (e.g. override ElementAttributeChanged for change rules). The argument to the method gives you a reference to the model element that is being affected.

    2) Add a "RuleOn" attribute to the class to specify when the rule will fire and which elements of your model it relates to.

    3) [Updated for DslTools v1] Override the LanguageModel.GetCustomDomainModelTypes() method to return the rules you have defined.

    Duncan


  • How to implement Rules in DSL