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

Integrating your Custom Producer to the Modeler


Creating your own custom producers in CodeFluent Entities is pretty straightforward: all you have to do is implement the IProducer interface. This interface contains three methods:

  • Initialize, which takes as a parameter an instance of the CodeFluent Entities project and the current producer
  • Produce,
  • Terminate

When using CodeFluent Entities directly from the command line via its CodeFluent.Build.exe, nothing special was required: declare a producer element as usual and set the typeName attribute of the producer element to your IProducer implementation. But what about integrating to the Modeler? Well it’s just as easy!

First, open Visual Studio and in Tools > Options… > CodeFluent Entities, 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.

CustomConfig

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

<codeFluent.Modeler>
    <producerDescriptors>
      <producerDescriptor name="MyProducer" displayName="MyProducer" category="MyStuff" typeName="CodeFluent.Producers.CodeDom.EntityFrameworkProducer, CodeFluent.Producers.CodeDom" />
    </producerDescriptors>
</codeFluent.Modeler>

As you can see, we’re adding a producer descriptor named “MyProducer” in the “MyStuff” category, and this producer points to the EntityFrameworkProducer provided in the CodeFluent.Producers.CodeDom assembly.

If you create a new CodeFluent Entities project and add a new producer to your project, you’ll now see:

AddNewProducer

Voilà! The “MyProducer” was added to the “MyStuff” category and you can now use your own custom producer just as any other producer Smile

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