public static TTerm AddTerm <TTerm>(BaseTaxonomy taxonomy, Session session, string termPath, string termName) where TTerm : BaseTerm { var term = GetTerm <TTerm>(session, StructurePath(taxonomy.Key, termPath)); if (term == null) { string[] pathSegments = GetPathSegments(taxonomy.Key, termPath); if (pathSegments.Length == 0) { throw new UserFriendlyException(new ArgumentException(String.Format("Invalid path: {0}", termPath))); } term = (TTerm)Activator.CreateInstance(typeof(TTerm), session); term.Key = pathSegments.Last(); term.Name = String.IsNullOrEmpty(termName) ? pathSegments.Last() : termName; string parentPath = termPath.Substring(0, termPath.LastIndexOf("/")); if (!string.IsNullOrEmpty(parentPath) && parentPath != taxonomy.Key) { term.ParentTerm = AddTerm <TTerm>(taxonomy, session, parentPath, String.Empty); } else if (session != taxonomy.Session) { term.BaseTaxonomy = (IBaseTaxonomy)session.GetObject(taxonomy); } else { term.BaseTaxonomy = taxonomy; } term.EvaluateTermPropertyValues(false); } return(term); }
public static TTerm AddStructuralTerm <TTerm>(BaseTaxonomy taxonomy, Session session, string termPath, string termName, Type[] types) where TTerm : BaseTerm, IStructuralTerm { var term = AddTerm <TTerm>(taxonomy, session, termPath, termName); term.UpdateTypes(types); return(term); }
public static TTerm AddValueTerm <TTerm>(BaseTaxonomy taxonomy, Session session, string termPath, string termName, IStructuralTerm structuralTerm) where TTerm : BaseTerm, IValueTerm { var term = AddValueTerm <TTerm>(taxonomy, session, termPath, termName); term.StructuralTerm = structuralTerm; return(term); }
public TaxonomyManager(Session session, BaseTaxonomy taxonomy) { _session = session; _taxonomy = taxonomy; }
public TaxonomyManager(BaseTaxonomy taxonomy) : this(taxonomy.Session, taxonomy) { }
public static TTerm AddValueTerm <TTerm>(BaseTaxonomy taxonomy, Session session, string termPath, string termName) where TTerm : BaseTerm, IValueTerm { return(AddTerm <TTerm>(taxonomy, session, termPath, termName)); }