Attaching elements

Step 4: Adding New ElementAttachingProvider to Composite.config

Now we should add our new ElementAttachingProvider to Composite.config and see the result.

Here is a section of the Composite.config file.

<Composite.C1Console.Elements.Plugins.ElementAttachingProviderConfiguration>
  <ElementAttachingProviderPlugins>
  <!--  Existing providers -->
  <add name="MyElementAttachingProvider"     type="AttachingCustomElementsSample.MyElementAttachingProvider, AttachingCustomElementsSample" />
  </ElementAttachingProviderPlugins>
</Composite.C1Console.Elements.Plugins.ElementAttachingProviderConfiguration>

We have added our new ElementAttachingProvider with this line:

<add name="MyElementAttachingProvider"      type="AttachingCustomElementsSample.MyElementAttachingProvider, AttachingCustomElementsSample" />

And when C1 CMS is restarted, our fine new root element should be shown in the Content perspective. As mentioned earlier, our ElementAttachingProvider doesn’t have any custom configuration. If it had, that would have been added as child elements to the <add> element in the listing above. Note that because our root element reports that it has children and our GetChildren method throws a NotImplementedException, then trying to open the root element in the tree will result in an error.