Table of Contents

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 ItemType
Metadata 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 string
System 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

MetadataContainer

DerivedMetadata

Gets the collection of detived metadata of an metadata this repository is currently working with.
protected MetadataContainer DerivedMetadata { get; }

Property Value

MetadataContainer

Metadata

Gets the metadata of an item this repository is currently working with.
protected ItemType Metadata { get; }

Property Value

ItemType

ValueConverter

Gets the value converter that is used to convert values from one representation into another one.
protected ValueConverter ValueConverter { get; }

Property Value

ValueConverter

Methods

Delete(ItemEntry)

Deletes the given item.
public virtual void Delete(ItemEntry item)

Parameters

item ItemEntry
Item to delete.

Delete(ItemEntry, ItemContext)

Deletes the given item.
public virtual void Delete(ItemEntry item, ItemContext context)

Parameters

item ItemEntry
Item to delete.
context ItemContext
Execution 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 ItemContext
Execution 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 bool
Clean 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 string
Item Id.

DeleteById(string, bool)

Deletes an item with the given Id.
public virtual void DeleteById(string id, bool cleanup)

Parameters

id string
Item Id.
cleanup bool
Clean item info from related page/paragraph entry or not.

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 int
Page 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 int
Paragraph 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 string
Command 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

command string
Command name.
parameters object[]
Command 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

string

GetFullQualifiedPrimaryKeyName(ItemType)

public virtual string GetFullQualifiedPrimaryKeyName(ItemType metadata)

Parameters

metadata ItemType

Returns

string

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 ItemEntry
Item to read field value from.
field SystemField
Field.

Returns

object
Field value.

ReadValue(ItemEntry, string)

Reads field value from the given item.
public static object ReadValue(ItemEntry item, string field)

Parameters

item ItemEntry
Item to read field value from.
field string
Field.

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 ItemEntry
Item to read field value from.
field SystemField
Field.

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

item ItemEntry
Item to read field value from.
field string
Field.

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 int
Area 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

areaId int
Area Id.
query Query
Query that is used to provide additional constraints.

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 int
Area Id.
query Query
Query that is used to provide additional constraints.
includeParagraphs bool
Are 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 int
Area Id.
query Query
Query that is used to provide additional constraints.
includeParagraphs bool
Are 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 int
Area Id.
query Query
Query that is used to provide additional constraints.
includeParagraphs bool
Are paragraphs included.
checkPermissions bool
includeInheritedItems 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 int
Area 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

areaId int
Area Id.
query Query
Query that is used to provide additional constraints.

Returns

IEnumerable<T>
Items.

Type Parameters

T

SelectById(string)

Selects the item by its Id.
public virtual Item SelectById(string id)

Parameters

id string
Item 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

id string
Item Id.
query Query
Query that is used to provide additional constraints.

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 string
Item 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

id string
Item Id.
query Query
Query that is used to provide additional constraints.

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 Query
Query 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 Query
Query that is used to provide additional constraints.
checkPermissions bool
To 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 Query
Query that is used to provide additional constraints.
checkPermissions bool
To 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 Query
Query that is used to provide additional constraints.

Returns

IEnumerable<T>
Items with the given Ids.

Type Parameters

T
Item type.

SelectByNamedList(int, Query, bool)

[Obsolete("Use SelectByNamedListId instead.")]
public virtual IEnumerable<Item> SelectByNamedList(int namedlistId, Query query, bool checkPermissions)

Parameters

namedlistId int
query Query
checkPermissions bool

Returns

IEnumerable<Item>

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

namedListId int
Named list id.
query Query
checkPermissions bool

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 Query
Query 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 int
Page 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

pageId int
Page Id.
query Query
Query that is used to provide additional constraints.

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 Query
Query 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 int
Page 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

pageId int
Page Id.
query Query
Query that is used to provide additional constraints.

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 Query
Query 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 int
Paragraph 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

paragraphId int
Paragraph Id.
query Query
Query that is used to provide additional constraints.

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 Query
Query 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 int
Paragraph 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

paragraphId int
Paragraph Id.
query Query
Query that is used to provide additional constraints.

Returns

IEnumerable<T>
Items.

Type Parameters

T

SelectByParentPageId(IEnumerable<int>, Query, bool, bool, bool)

[Obsolete("Use SelectByParentPageIds instead.")]
public virtual IEnumerable<Item> SelectByParentPageId(IEnumerable<int> pids, Query query, bool includeParagraphs, bool includeAllChildItems, bool checkPermissions)

Parameters

pids IEnumerable<int>
query Query
includeParagraphs bool
includeAllChildItems bool
checkPermissions bool

Returns

IEnumerable<Item>

SelectByParentPageId(IEnumerable<int>, Query, bool, bool, bool, bool)

[Obsolete("Use SelectByParentPageIds instead.")]
public virtual IEnumerable<Item> SelectByParentPageId(IEnumerable<int> pids, Query query, bool includeParagraphs, bool includeAllChildItems, bool checkPermissions, bool includeInheritedItems)

Parameters

pids IEnumerable<int>
query Query
includeParagraphs bool
includeAllChildItems bool
checkPermissions bool
includeInheritedItems bool

Returns

IEnumerable<Item>

SelectByParentPageId(int)

Selects all items by the given parent page Id.
public virtual IEnumerable<Item> SelectByParentPageId(int pageId)

Parameters

pageId int
Page 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

pageId int
Page Id.
query Query
Query that is used to provide additional constraints.

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 int
Page Id.
query Query
Query that is used to provide additional constraints.
includeParagraphs bool
Are paragraphs included.
includeAllChildItems bool
Are 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 int
Page Id.
query Query
Query that is used to provide additional constraints.
includeParagraphs bool
Are paragraphs included.
includeAllChildItems bool
Are 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 int
Page 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

pageId int
Page Id.
query Query
Query that is used to provide additional constraints.

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 Query
Query that is used to provide additional constraints.
includeParagraphs bool
Are paragraphs included.
includeChildItems bool
Are 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 Query
Query that is used to provide additional constraints.
includeParagraphs bool
Are paragraphs included.
includeChildItems bool
Are all children included.
checkPermissions bool
includeInheritedItems 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 string
Name of the field on the source item
targetItemType string
Item type of the target item
targetItemId string
Id of the target item
query Query
includeParagraphs bool
checkPermissions bool

Returns

IEnumerable<Item>

SynchronizePageStructure(Item, bool, Item)

Synchronize changes in items with pages
public void SynchronizePageStructure(Item currentItem, bool updateModificationDate, Item originalItem)

Parameters

currentItem Item
updateModificationDate bool
originalItem Item

SynchronizePageStructure(Item, bool, Item, ItemContext)

Synchronize changes in items with pages
public void SynchronizePageStructure(Item currentItem, bool updateModificationDate, Item originalItem, ItemContext context)

Parameters

currentItem Item
updateModificationDate bool
originalItem Item
context ItemContext

Update(ItemEntry)

Either inserts new or updates existing record that correspond to the given item.
public virtual string Update(ItemEntry item)

Parameters

item ItemEntry
Item 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 ItemEntry
Item to insert/update.
context ItemContext
Context 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 ItemContext
Context 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 ItemContext
Context of the items.
synchronizePages bool
Synchronize pages after update

Remarks

If the list contains only one item, the Id of the item is updated in case it was inserted.
To top