Home > Developing Using CodeFluent Entities > Integrating your Custom Rule to the Modeler

Integrating your Custom Rule to the Modeler

We saw in a previous post that we could integrate your own custom producer to the Modeler by adding a producerDescriptor element to the Custom.config; well the same feature is available to rules as well.

As you know, you can define rules in your model such as:

To add them to the modeler so you can use them through the “Add Rule Dialog” rather than in XML, you need to locate the Custom Configuration File. Open Visual Studio and in Tools > Options… > CodeFluent Entities, and select the advanced view using the advanced button at the top of the property grid. As you can see, there’s a property named “Custom Configuration File Path” which points to a Custom.config file.

By default, this file doesn’t exist, get to the pointed directory and create this Custom.config file with the following content:

          <ruleDescriptor name="MyCustomRule" displayName="My Custom Rule" targets="Entity, Project" typeName="CodeFluent.Modeler.Design.Rules.UnresolvedRuleDescriptor, CodeFluent.Modeler"> 
              <propertyDescriptors category="Global"> 
                  <propertyDescriptor name="MyValue" defaultValue="" options="Mandatory" description="A Mandatory value" category="MyCategory" /> 
                  <propertyDescriptor name="MyBoolValue" typeName="System.Boolean" defaultValue="true" /> 

Launch Visual Studio, open a model and click “Add Rule” on the project or an entity:


Ta-da! Our custom rule was added to the modeler!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s