private void DeployDefinition(object modelHost, SiteModelHost siteModelHost, CustomDocumentIdProviderDefinition definition)
        {
            var site = siteModelHost.HostSite;

            var targetType = Type.GetType(definition.DocumentProviderType);
            var targetInstance = Activator.CreateInstance(targetType) as DocumentIdProvider;

            InvokeOnModelEvent(this, new ModelEventArgs
            {
                CurrentModelNode = null,
                Model = null,
                EventType = ModelEventType.OnProvisioning,
                Object = site,
                ObjectType = typeof(SPSite),
                ObjectDefinition = definition,
                ModelHost = modelHost
            });

            DocumentId.SetProvider(site, targetInstance);

            InvokeOnModelEvent(this, new ModelEventArgs
            {
                CurrentModelNode = null,
                Model = null,
                EventType = ModelEventType.OnProvisioned,
                Object = site,
                ObjectType = typeof(SPSite),
                ObjectDefinition = definition,
                ModelHost = modelHost
            });
        }
 public static ModelNode AddCustomDocumentIdProvider(this ModelNode model, CustomDocumentIdProviderDefinition definition, Action<ModelNode> action)
 {
     return model.AddDefinitionNode(definition, action);
 }
 public static ModelNode AddCustomDocumentIdProvider(this ModelNode model, CustomDocumentIdProviderDefinition definition)
 {
     return AddCustomDocumentIdProvider(model, definition, null);
 }