Пример #1
0
        public override void DeployModel(object modelHost, DefinitionBase model)
        {
            var definition = model.WithAssertAndCast <TaxonomyTermDefinition>("model", value => value.RequireNotNull());

            // TODO, move to common validator infrastructure
            if (!TaxonomyUtility.IsValidTermName(definition.Name))
            {
                throw new SPMeta2Exception(
                          string.Format("Term name [{0}] cannot contain any of the following characters: \" ; < > | and Tab",
                                        definition.Name));
            }

            if (modelHost is TermModelHost)
            {
                DeployTermUnderTerm(modelHost, modelHost as TermModelHost, definition);
            }
            else if (modelHost is TermSetModelHost)
            {
                DeployTermUnderTermSet(modelHost, modelHost as TermSetModelHost, definition);
            }
            else
            {
                throw new SPMeta2UnsupportedModelHostException(string.Format("Model host of type: [{0}] is not supported", modelHost.GetType()));
            }
        }
Пример #2
0
 protected virtual string NormalizeTermName(string termName)
 {
     return(TaxonomyUtility.NormalizeName(termName));
 }