Class CategoryRepository
Inheritance
Namespace: EPiServer.DataAbstraction
Assembly: EPiServer.dll
Version: 12.0.3Syntax
public abstract class CategoryRepository : Object
Constructors
CategoryRepository()
Declaration
protected CategoryRepository()
Methods
Delete(Category)
Delete the current category and all descendant categories.
Declaration
public abstract void Delete(Category category)
Parameters
Type | Name | Description |
---|---|---|
Category | category |
Remarks
You will have to reload the parent category to get an updated view of the category tree.
Get(Int32)
Recursive search for a category with the provided id starting at the root.
Declaration
public abstract Category Get(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | The id of the Category to retrieve |
Returns
Type | Description |
---|---|
Category | The Category with the provided id if found: otherwise null. |
Get(String)
Recursive search for a Category with the provided name starting at the root.
Declaration
public abstract Category Get(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the Category to retrieve. |
Returns
Type | Description |
---|---|
Category | The first Category with the provided name if found; otherwise null. |
Remarks
Search is not case-sensitive (uses OrdinalIgnoreCase).
GetRoot()
Get the category tree starting at the root
Declaration
public abstract Category GetRoot()
Returns
Type | Description |
---|---|
Category | The root category |
Save(Category)
Save changes made to the current Category instance.
Declaration
public abstract void Save(Category category)
Parameters
Type | Name | Description |
---|---|---|
Category | category |
Remarks
This method will only save changes to the current category. Any added or modified child categories must be saved individually.