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
metadataItemTypeMetadata of an item this repository is currently working with.
Exceptions
- ArgumentNullException
metadatais 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
systemNamestringSystem 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
itemItemEntryItem to delete.
Delete(ItemEntry, ItemContext?)
Deletes the given item.
public virtual void Delete(ItemEntry item, ItemContext? context)
Parameters
itemItemEntryItem to delete.
contextItemContextExecution context.
Delete(IEnumerable<ItemEntry>)
Deletes the given items.
public virtual void Delete(IEnumerable<ItemEntry> items)
Parameters
itemsIEnumerable<ItemEntry>Items to delete.
Delete(IEnumerable<ItemEntry>, ItemContext?)
Deletes the given items.
public virtual void Delete(IEnumerable<ItemEntry> items, ItemContext? context)
Parameters
itemsIEnumerable<ItemEntry>Items to delete.
contextItemContextExecution context.
DeleteById(IEnumerable<string>)
Deletes all items with the given Ids.
public virtual void DeleteById(IEnumerable<string> ids)
Parameters
idsIEnumerable<string>Item Ids.
DeleteById(IEnumerable<string>, bool)
Deletes all items with the given Ids.
public virtual void DeleteById(IEnumerable<string> ids, bool cleanup)
Parameters
idsIEnumerable<string>Item Ids.
cleanupboolClean 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
idstringItem 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
pageIdsIEnumerable<int>Page Ids.
DeleteByPageId(int)
Deletes all items with the given page Id.
public virtual void DeleteByPageId(int pageId)
Parameters
pageIdintPage Id.
DeleteByParagraphId(IEnumerable<int>)
Deletes all items with the given paragraph Ids.
public virtual void DeleteByParagraphId(IEnumerable<int> paragraphIds)
Parameters
paragraphIdsIEnumerable<int>Paragraph Ids.
DeleteByParagraphId(int)
Deletes all items with the given paragraph Id.
public virtual void DeleteByParagraphId(int paragraphId)
Parameters
paragraphIdintParagraph 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
commandstringCommand name.
Returns
- TResult
The result of a command execution.
Type Parameters
TResultResult 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
TResultResult type.
Exceptions
- NotSupportedException
Specified command is not supported.
GetFullQualifiedColumnName(ItemField)
public virtual string GetFullQualifiedColumnName(ItemField field)
Parameters
fieldItemField
Returns
GetFullQualifiedPrimaryKeyName(ItemType)
public virtual string GetFullQualifiedPrimaryKeyName(ItemType metadata)
Parameters
metadataItemType
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
itemItemEntryItem to read field value from.
fieldSystemFieldField.
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
itemItemEntryItem to read field value from.
fieldSystemFieldField.
Returns
- T
Field value.
Type Parameters
TValue 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
TValue 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
areaIdintArea 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
areaIdintArea Id.
queryQueryQuery that is used to provide additional constraints.
includeParagraphsboolAre 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
areaIdintArea Id.
queryQueryQuery that is used to provide additional constraints.
includeParagraphsboolAre paragraphs included.
checkPermissionsbool
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
areaIdintArea Id.
queryQueryQuery that is used to provide additional constraints.
includeParagraphsboolAre paragraphs included.
checkPermissionsboolincludeInheritedItemsbool
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
areaIdintArea 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
idstringItem 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
idstringItem 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
idsIEnumerable<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
idsIEnumerable<string>Item Ids.
queryQueryQuery 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
idsIEnumerable<string>Item Ids.
queryQueryQuery that is used to provide additional constraints.
checkPermissionsboolTo 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
idsIEnumerable<string>Item Ids.
queryQueryQuery that is used to provide additional constraints.
checkPermissionsboolTo check permissions of current user.
includeInheritedItemsbool
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
idsIEnumerable<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
idsIEnumerable<string>Item Ids.
queryQueryQuery that is used to provide additional constraints.
Returns
- IEnumerable<T>
Items with the given Ids.
Type Parameters
TItem 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
pageIdsIEnumerable<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
pageIdsIEnumerable<int>Page Ids.
queryQueryQuery 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
pageIdintPage 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
pageIdsIEnumerable<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
pageIdsIEnumerable<int>Page Ids.
queryQueryQuery 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
pageIdintPage 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
paragraphIdsIEnumerable<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
paragraphIdsIEnumerable<int>Paragraph Ids.
queryQueryQuery 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
paragraphIdintParagraph 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
paragraphIdsIEnumerable<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
paragraphIdsIEnumerable<int>Paragraph Ids.
queryQueryQuery 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
paragraphIdintParagraph 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
pageIdintPage 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
pageIdintPage Id.
queryQueryQuery that is used to provide additional constraints.
includeParagraphsboolAre paragraphs included.
includeAllChildItemsboolAre 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
pageIdintPage Id.
queryQueryQuery that is used to provide additional constraints.
includeParagraphsboolAre paragraphs included.
includeAllChildItemsboolAre all childs included.
checkPermissionsbool
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
pageIdintPage 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
parentIdsIEnumerable<int>List of parent Ids.
queryQueryQuery that is used to provide additional constraints.
includeParagraphsboolAre paragraphs included.
includeChildItemsboolAre all children included.
checkPermissionsbool
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
parentIdsIEnumerable<int>List of parent Ids.
queryQueryQuery that is used to provide additional constraints.
includeParagraphsboolAre paragraphs included.
includeChildItemsboolAre all children included.
checkPermissionsboolincludeInheritedItemsbool
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
sourceFieldNamestringName of the field on the source item
targetItemTypestringItem type of the target item
targetItemIdstringId of the target item
queryQueryincludeParagraphsboolcheckPermissionsbool
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
currentItemItemupdateModificationDatebooloriginalItemItemcontextItemContext
Update(ItemEntry)
Either inserts new or updates existing record that correspond to the given item.
public virtual string Update(ItemEntry item)
Parameters
itemItemEntryItem 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
itemItemEntryItem to insert/update.
contextItemContextContext 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
itemsIEnumerable<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
itemsIEnumerable<ItemEntry>Items to insert/update.
contextItemContextContext 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
itemsIEnumerable<ItemEntry>Items to insert/update.
contextItemContextContext of the items.
synchronizePagesboolSynchronize pages after update
Remarks
If the list contains only one item, the Id of the item is updated in case it was inserted.