Class Repository
- Namespace
- Dynamicweb.Content.Items.Queries
- Assembly
- Dynamicweb.dll
Represents a relational database repository.
public class Repository : IDisposable
- Inheritance
-
Repository
- Implements
- Inherited Members
Constructors
Repository(ItemType)
Initializes a new instance of an object.
public Repository(ItemType metadata)
Parameters
metadata
ItemTypeMetadata of an item this repository is currently working with.
Exceptions
- ArgumentNullException
metadata
is null.- ArgumentException
The SysteName property of a given item metadata is null or an empty string.
Repository(string)
Initializes a new instance of an object.
public Repository(string systemName)
Parameters
systemName
stringSystem name of the target item.
Properties
BaseMetadata
Gets the collection of base metadata of an metadata this repository is currently working with.
protected MetadataContainer BaseMetadata { get; }
Property Value
DerivedMetadata
Gets the collection of detived metadata of an metadata this repository is currently working with.
protected MetadataContainer DerivedMetadata { get; }
Property Value
Metadata
Gets the metadata of an item this repository is currently working with.
protected ItemType Metadata { get; }
Property Value
ValueConverter
Gets the value converter that is used to convert values from one representation into another one.
protected ValueConverter ValueConverter { get; }
Property Value
Methods
Delete(ItemEntry)
Deletes the given item.
public virtual void Delete(ItemEntry item)
Parameters
item
ItemEntryItem to delete.
Delete(ItemEntry, ItemContext)
Deletes the given item.
public virtual void Delete(ItemEntry item, ItemContext context)
Parameters
item
ItemEntryItem to delete.
context
ItemContextExecution context.
Delete(IEnumerable<ItemEntry>)
Deletes the given items.
public virtual void Delete(IEnumerable<ItemEntry> items)
Parameters
items
IEnumerable<ItemEntry>Items to delete.
Delete(IEnumerable<ItemEntry>, ItemContext)
Deletes the given items.
public virtual void Delete(IEnumerable<ItemEntry> items, ItemContext context)
Parameters
items
IEnumerable<ItemEntry>Items to delete.
context
ItemContextExecution context.
DeleteById(IEnumerable<string>)
Deletes all items with the given Ids.
public virtual void DeleteById(IEnumerable<string> ids)
Parameters
ids
IEnumerable<string>Item Ids.
DeleteById(IEnumerable<string>, bool)
Deletes all items with the given Ids.
public virtual void DeleteById(IEnumerable<string> ids, bool cleanup)
Parameters
ids
IEnumerable<string>Item Ids.
cleanup
boolClean item info from related page/paragraph entry or not.
DeleteById(string)
Deletes an item with the given Id.
public virtual void DeleteById(string id)
Parameters
id
stringItem Id.
DeleteById(string, bool)
Deletes an item with the given Id.
public virtual void DeleteById(string id, bool cleanup)
Parameters
DeleteByPageId(IEnumerable<int>)
Deletes all items with the given page Ids.
public virtual void DeleteByPageId(IEnumerable<int> pageIds)
Parameters
pageIds
IEnumerable<int>Page Ids.
DeleteByPageId(int)
Deletes all items with the given page Id.
public virtual void DeleteByPageId(int pageId)
Parameters
pageId
intPage Id.
DeleteByParagraphId(IEnumerable<int>)
Deletes all items with the given paragraph Ids.
public virtual void DeleteByParagraphId(IEnumerable<int> paragraphIds)
Parameters
paragraphIds
IEnumerable<int>Paragraph Ids.
DeleteByParagraphId(int)
Deletes all items with the given paragraph Id.
public virtual void DeleteByParagraphId(int paragraphId)
Parameters
paragraphId
intParagraph Id.
Dispose()
Disposes all managed resources used by this repository.
public void Dispose()
Execute<TResult>(string)
Executes the given named command and returns the result of an execution.
public virtual TResult Execute<TResult>(string command)
Parameters
command
stringCommand name.
Returns
- TResult
The result of a command execution.
Type Parameters
TResult
Result type.
Exceptions
- NotSupportedException
Specified command is not supported.
Execute<TResult>(string, params object[])
Executes the given named command and returns the result of an execution.
public virtual TResult Execute<TResult>(string command, params object[] parameters)
Parameters
Returns
- TResult
The result of a command execution.
Type Parameters
TResult
Result type.
Exceptions
- NotSupportedException
Specified command is not supported.
GetFullQualifiedColumnName(ItemField)
public virtual string GetFullQualifiedColumnName(ItemField field)
Parameters
field
ItemField
Returns
GetFullQualifiedPrimaryKeyName(ItemType)
public virtual string GetFullQualifiedPrimaryKeyName(ItemType metadata)
Parameters
metadata
ItemType
Returns
OnDisposing()
Called when the managed resources needs to be disposed.
protected virtual void OnDisposing()
ReadValue(ItemEntry, SystemField)
Reads field value from the given item.
public static object ReadValue(ItemEntry item, SystemField field)
Parameters
item
ItemEntryItem to read field value from.
field
SystemFieldField.
Returns
- object
Field value.
ReadValue(ItemEntry, string)
Reads field value from the given item.
public static object ReadValue(ItemEntry item, string field)
Parameters
Returns
- object
Field value.
ReadValue<T>(ItemEntry, SystemField)
Reads field value from the given item.
public static T ReadValue<T>(ItemEntry item, SystemField field)
Parameters
item
ItemEntryItem to read field value from.
field
SystemFieldField.
Returns
- T
Field value.
Type Parameters
T
Value type.
ReadValue<T>(ItemEntry, string)
Reads field value from the given item.
public static T ReadValue<T>(ItemEntry item, string field)
Parameters
Returns
- T
Field value.
Type Parameters
T
Value type.
SelectAll()
Selects all items.
public virtual IEnumerable<Item> SelectAll()
Returns
- IEnumerable<Item>
All items.
SelectByAreaId(int)
Selects all items by the given language/area Id.
public virtual IEnumerable<Item> SelectByAreaId(int areaId)
Parameters
areaId
intArea Id.
Returns
- IEnumerable<Item>
Items.
SelectByAreaId(int, Query)
Selects all items by the given language/area Id.
public virtual IEnumerable<Item> SelectByAreaId(int areaId, Query query)
Parameters
Returns
- IEnumerable<Item>
Items.
SelectByAreaId(int, Query, bool)
Selects all items by the given language/area Id.
public virtual IEnumerable<Item> SelectByAreaId(int areaId, Query query, bool includeParagraphs)
Parameters
areaId
intArea Id.
query
QueryQuery that is used to provide additional constraints.
includeParagraphs
boolAre paragraphs included.
Returns
- IEnumerable<Item>
Items.
SelectByAreaId(int, Query, bool, bool)
Selects all items by the given language/area Id.
public virtual IEnumerable<Item> SelectByAreaId(int areaId, Query query, bool includeParagraphs, bool checkPermissions)
Parameters
areaId
intArea Id.
query
QueryQuery that is used to provide additional constraints.
includeParagraphs
boolAre paragraphs included.
checkPermissions
bool
Returns
- IEnumerable<Item>
Items.
SelectByAreaId(int, Query, bool, bool, bool)
Selects all items by the given language/area Id.
public virtual IEnumerable<Item> SelectByAreaId(int areaId, Query query, bool includeParagraphs, bool checkPermissions, bool includeInheritedItems)
Parameters
areaId
intArea Id.
query
QueryQuery that is used to provide additional constraints.
includeParagraphs
boolAre paragraphs included.
checkPermissions
boolincludeInheritedItems
bool
Returns
- IEnumerable<Item>
Items.
SelectByAreaId<T>(int)
Selects all items by the given language/area Id.
public virtual IEnumerable<T> SelectByAreaId<T>(int areaId) where T : ItemEntry, new()
Parameters
areaId
intArea Id.
Returns
- IEnumerable<T>
Items.
Type Parameters
T
SelectByAreaId<T>(int, Query)
Selects all items by the given language/area Id.
public virtual IEnumerable<T> SelectByAreaId<T>(int areaId, Query query) where T : ItemEntry, new()
Parameters
Returns
- IEnumerable<T>
Items.
Type Parameters
T
SelectById(string)
Selects the item by its Id.
public virtual Item SelectById(string id)
Parameters
id
stringItem Id.
Returns
- Item
Item with the given Id.
SelectById(string, Query)
Selects the item by its Id.
public virtual Item SelectById(string id, Query query)
Parameters
Returns
- Item
Item with the given Id.
SelectById<T>(string)
Selects the item by its Id.
public virtual T SelectById<T>(string id) where T : ItemEntry, new()
Parameters
id
stringItem Id.
Returns
- T
Item with the given Id.
Type Parameters
T
SelectById<T>(string, Query)
Selects the item by its Id.
public virtual T SelectById<T>(string id, Query query) where T : ItemEntry, new()
Parameters
Returns
- T
Item with the given Id.
Type Parameters
T
SelectByIds(IEnumerable<string>)
Selects items by their Ids.
public virtual IEnumerable<Item> SelectByIds(IEnumerable<string> ids)
Parameters
ids
IEnumerable<string>Item Ids.
Returns
- IEnumerable<Item>
Items with the given Ids.
SelectByIds(IEnumerable<string>, Query)
Selects items by their Ids.
public virtual IEnumerable<Item> SelectByIds(IEnumerable<string> ids, Query query)
Parameters
ids
IEnumerable<string>Item Ids.
query
QueryQuery that is used to provide additional constraints.
Returns
- IEnumerable<Item>
Items with the given Ids.
SelectByIds(IEnumerable<string>, Query, bool)
Selects items by their Ids.
public virtual IEnumerable<Item> SelectByIds(IEnumerable<string> ids, Query query, bool checkPermissions)
Parameters
ids
IEnumerable<string>Item Ids.
query
QueryQuery that is used to provide additional constraints.
checkPermissions
boolTo check permissions of current user.
Returns
- IEnumerable<Item>
Items with the given Ids.
SelectByIds(IEnumerable<string>, Query, bool, bool)
Selects items by their Ids.
public virtual IEnumerable<Item> SelectByIds(IEnumerable<string> ids, Query query, bool checkPermissions, bool includeInheritedItems)
Parameters
ids
IEnumerable<string>Item Ids.
query
QueryQuery that is used to provide additional constraints.
checkPermissions
boolTo check permissions of current user.
includeInheritedItems
bool
Returns
- IEnumerable<Item>
Items with the given Ids.
SelectByIds<T>(IEnumerable<string>)
Selects items by their Ids.
public virtual IEnumerable<T> SelectByIds<T>(IEnumerable<string> ids) where T : ItemEntry, new()
Parameters
ids
IEnumerable<string>Item Ids.
Returns
- IEnumerable<T>
Items with the given Ids.
Type Parameters
T
SelectByIds<T>(IEnumerable<string>, Query)
Selects items by their Ids.
public virtual IEnumerable<T> SelectByIds<T>(IEnumerable<string> ids, Query query) where T : ItemEntry, new()
Parameters
ids
IEnumerable<string>Item Ids.
query
QueryQuery that is used to provide additional constraints.
Returns
- IEnumerable<T>
Items with the given Ids.
Type Parameters
T
Item type.
SelectByNamedListId(int, Query, bool)
Selects all items by the given named list Id.
public virtual IEnumerable<Item> SelectByNamedListId(int namedListId, Query query, bool checkPermissions)
Parameters
Returns
- IEnumerable<Item>
Items.
SelectByPageId(IEnumerable<int>)
Selects all items by the given page Id.
public virtual IEnumerable<Item> SelectByPageId(IEnumerable<int> pageIds)
Parameters
pageIds
IEnumerable<int>Page Ids.
Returns
- IEnumerable<Item>
Items.
SelectByPageId(IEnumerable<int>, Query)
Selects all items by the given page Id.
public virtual IEnumerable<Item> SelectByPageId(IEnumerable<int> pageIds, Query query)
Parameters
pageIds
IEnumerable<int>Page Ids.
query
QueryQuery that is used to provide additional constraints.
Returns
- IEnumerable<Item>
Items.
SelectByPageId(int)
Selects all items by the given page Id.
public virtual IEnumerable<Item> SelectByPageId(int pageId)
Parameters
pageId
intPage Id.
Returns
- IEnumerable<Item>
Items.
SelectByPageId(int, Query)
Selects all items by the given page Id.
public virtual IEnumerable<Item> SelectByPageId(int pageId, Query query)
Parameters
Returns
- IEnumerable<Item>
Items.
SelectByPageId<T>(IEnumerable<int>)
Selects all items by the given page Id.
public virtual IEnumerable<T> SelectByPageId<T>(IEnumerable<int> pageIds) where T : ItemEntry, new()
Parameters
pageIds
IEnumerable<int>Page Ids.
Returns
- IEnumerable<T>
Items.
Type Parameters
T
SelectByPageId<T>(IEnumerable<int>, Query)
Selects all items by the given page Id.
public virtual IEnumerable<T> SelectByPageId<T>(IEnumerable<int> pageIds, Query query) where T : ItemEntry, new()
Parameters
pageIds
IEnumerable<int>Page Ids.
query
QueryQuery that is used to provide additional constraints.
Returns
- IEnumerable<T>
Items.
Type Parameters
T
SelectByPageId<T>(int)
Selects all items by the given page Id.
public virtual IEnumerable<T> SelectByPageId<T>(int pageId) where T : ItemEntry, new()
Parameters
pageId
intPage Id.
Returns
- IEnumerable<T>
Items.
Type Parameters
T
SelectByPageId<T>(int, Query)
Selects all items by the given page Id.
public virtual IEnumerable<T> SelectByPageId<T>(int pageId, Query query) where T : ItemEntry, new()
Parameters
Returns
- IEnumerable<T>
Items.
Type Parameters
T
SelectByParagraphId(IEnumerable<int>)
Selects all items by the given page Id.
public virtual IEnumerable<Item> SelectByParagraphId(IEnumerable<int> paragraphIds)
Parameters
paragraphIds
IEnumerable<int>Paragraph Ids.
Returns
- IEnumerable<Item>
Items.
SelectByParagraphId(IEnumerable<int>, Query)
Selects all items by the given paragraph Id.
public virtual IEnumerable<Item> SelectByParagraphId(IEnumerable<int> paragraphIds, Query query)
Parameters
paragraphIds
IEnumerable<int>Paragraph Ids.
query
QueryQuery that is used to provide additional constraints.
Returns
- IEnumerable<Item>
Items.
SelectByParagraphId(int)
Selects all items by the given page Id.
public virtual IEnumerable<Item> SelectByParagraphId(int paragraphId)
Parameters
paragraphId
intParagraph Id.
Returns
- IEnumerable<Item>
Items.
SelectByParagraphId(int, Query)
Selects all items by the given paragraph Id.
public virtual IEnumerable<Item> SelectByParagraphId(int paragraphId, Query query)
Parameters
Returns
- IEnumerable<Item>
Items.
SelectByParagraphId<T>(IEnumerable<int>)
Selects all items by the given paragraph Id.
public virtual IEnumerable<T> SelectByParagraphId<T>(IEnumerable<int> paragraphIds) where T : ItemEntry, new()
Parameters
paragraphIds
IEnumerable<int>Paragraph Ids.
Returns
- IEnumerable<T>
Items.
Type Parameters
T
SelectByParagraphId<T>(IEnumerable<int>, Query)
Selects all items by the given paragraph Id.
public virtual IEnumerable<T> SelectByParagraphId<T>(IEnumerable<int> paragraphIds, Query query) where T : ItemEntry, new()
Parameters
paragraphIds
IEnumerable<int>Paragraph Ids.
query
QueryQuery that is used to provide additional constraints.
Returns
- IEnumerable<T>
Items.
Type Parameters
T
SelectByParagraphId<T>(int)
Selects all items by the given paragraph Id.
public virtual IEnumerable<T> SelectByParagraphId<T>(int paragraphId) where T : ItemEntry, new()
Parameters
paragraphId
intParagraph Id.
Returns
- IEnumerable<T>
Items.
Type Parameters
T
SelectByParagraphId<T>(int, Query)
Selects all items by the given paragraph Id.
public virtual IEnumerable<T> SelectByParagraphId<T>(int paragraphId, Query query) where T : ItemEntry, new()
Parameters
Returns
- IEnumerable<T>
Items.
Type Parameters
T
SelectByParentPageId(int)
Selects all items by the given parent page Id.
public virtual IEnumerable<Item> SelectByParentPageId(int pageId)
Parameters
pageId
intPage Id.
Returns
- IEnumerable<Item>
Items.
SelectByParentPageId(int, Query)
Selects all items by the given parent page Id.
public virtual IEnumerable<Item> SelectByParentPageId(int pageId, Query query)
Parameters
Returns
- IEnumerable<Item>
Items.
SelectByParentPageId(int, Query, bool, bool)
Selects all items by the given parent page Id including all childs.
public virtual IEnumerable<Item> SelectByParentPageId(int pageId, Query query, bool includeParagraphs, bool includeAllChildItems)
Parameters
pageId
intPage Id.
query
QueryQuery that is used to provide additional constraints.
includeParagraphs
boolAre paragraphs included.
includeAllChildItems
boolAre all childs included.
Returns
- IEnumerable<Item>
Items.
SelectByParentPageId(int, Query, bool, bool, bool)
Selects all items by the given parent page Id including all childs.
public virtual IEnumerable<Item> SelectByParentPageId(int pageId, Query query, bool includeParagraphs, bool includeAllChildItems, bool checkPermissions)
Parameters
pageId
intPage Id.
query
QueryQuery that is used to provide additional constraints.
includeParagraphs
boolAre paragraphs included.
includeAllChildItems
boolAre all childs included.
checkPermissions
bool
Returns
- IEnumerable<Item>
Items.
SelectByParentPageId<T>(int)
Selects all items by the given parent page Id.
public virtual IEnumerable<T> SelectByParentPageId<T>(int pageId) where T : ItemEntry, new()
Parameters
pageId
intPage Id.
Returns
- IEnumerable<T>
Items.
Type Parameters
T
SelectByParentPageId<T>(int, Query)
Selects all items by the given parent page Id.
public virtual IEnumerable<T> SelectByParentPageId<T>(int pageId, Query query) where T : ItemEntry, new()
Parameters
Returns
- IEnumerable<T>
Items.
Type Parameters
T
SelectByParentPageIds(IEnumerable<int>, Query, bool, bool, bool)
Selects all items by the given a list of parent pages Ids including all children.
public virtual IEnumerable<Item> SelectByParentPageIds(IEnumerable<int> parentIds, Query query, bool includeParagraphs, bool includeChildItems, bool checkPermissions)
Parameters
parentIds
IEnumerable<int>List of parent Ids.
query
QueryQuery that is used to provide additional constraints.
includeParagraphs
boolAre paragraphs included.
includeChildItems
boolAre all children included.
checkPermissions
bool
Returns
- IEnumerable<Item>
Items.
SelectByParentPageIds(IEnumerable<int>, Query, bool, bool, bool, bool)
Selects all items by the given a list of parent pages Ids including all childs.
public virtual IEnumerable<Item> SelectByParentPageIds(IEnumerable<int> parentIds, Query query, bool includeParagraphs, bool includeChildItems, bool checkPermissions, bool includeInheritedItems)
Parameters
parentIds
IEnumerable<int>List of parent Ids.
query
QueryQuery that is used to provide additional constraints.
includeParagraphs
boolAre paragraphs included.
includeChildItems
boolAre all children included.
checkPermissions
boolincludeInheritedItems
bool
Returns
- IEnumerable<Item>
Items.
SelectByReference(string, string, string, Query, bool, bool)
Find all items that references a given item in a given field.
public virtual IEnumerable<Item> SelectByReference(string sourceFieldName, string targetItemType, string targetItemId, Query query, bool includeParagraphs, bool checkPermissions)
Parameters
sourceFieldName
stringName of the field on the source item
targetItemType
stringItem type of the target item
targetItemId
stringId of the target item
query
QueryincludeParagraphs
boolcheckPermissions
bool
Returns
SynchronizePageStructure(Item, bool, Item)
Synchronize changes in items with pages
public void SynchronizePageStructure(Item currentItem, bool updateModificationDate, Item originalItem)
Parameters
SynchronizePageStructure(Item, bool, Item, ItemContext)
Synchronize changes in items with pages
public void SynchronizePageStructure(Item currentItem, bool updateModificationDate, Item originalItem, ItemContext context)
Parameters
currentItem
ItemupdateModificationDate
booloriginalItem
Itemcontext
ItemContext
Update(ItemEntry)
Either inserts new or updates existing record that correspond to the given item.
public virtual string Update(ItemEntry item)
Parameters
item
ItemEntryItem to insert/update.
Returns
- string
An Id of the item that was inserted/updated.
Update(ItemEntry, ItemContext)
Either inserts new or updates existing record that correspond to the given item.
public virtual string Update(ItemEntry item, ItemContext context)
Parameters
item
ItemEntryItem to insert/update.
context
ItemContextContext of the item.
Returns
- string
An Id of the item that was inserted/updated.
Update(IEnumerable<ItemEntry>)
Either inserts new or updates existing records that correspond to the given items.
public virtual void Update(IEnumerable<ItemEntry> items)
Parameters
items
IEnumerable<ItemEntry>Items to insert/update.
Remarks
If the list contains only one item, the Id of the item is updated in case it was inserted.
Update(IEnumerable<ItemEntry>, ItemContext)
Either inserts new or updates existing records that correspond to the given items.
public virtual void Update(IEnumerable<ItemEntry> items, ItemContext context)
Parameters
items
IEnumerable<ItemEntry>Items to insert/update.
context
ItemContextContext of the items.
Remarks
If the list contains only one item, the Id of the item is updated in case it was inserted.
Update(IEnumerable<ItemEntry>, ItemContext, bool)
Either inserts new or updates existing records that correspond to the given items.
public virtual void Update(IEnumerable<ItemEntry> items, ItemContext context, bool synchronizePages)
Parameters
items
IEnumerable<ItemEntry>Items to insert/update.
context
ItemContextContext of the items.
synchronizePages
boolSynchronize pages after update
Remarks
If the list contains only one item, the Id of the item is updated in case it was inserted.