Table of Contents

Class InfoObjectRepository<TCollection, TObject, TSettings>

Namespace
CMS.DataEngine
Assembly
CMS.DataEngine.dll

Repository for info objects.

public abstract class InfoObjectRepository<TCollection, TObject, TSettings> : IInfoObjectRepository<TCollection>, INamedEnumerable<TCollection>, INamedEnumerable, IHierarchicalObject, INameIndexable where TCollection : class, IInfoObjectCollection, IEnumerable<TObject> where TObject : BaseInfo where TSettings : BaseCollectionSettings

Type Parameters

TCollection
TObject
TSettings
Inheritance
object
InfoObjectRepository<TCollection, TObject, TSettings>
Implements
INamedEnumerable<TCollection>
Derived
Extension Methods

Constructors

InfoObjectRepository()

Constructor

public InfoObjectRepository()

Properties

All

All items from all underlying collections.

public virtual CombinedInfoObjectCollection<TCollection, TObject> All { get; }

Property Value

CombinedInfoObjectCollection<TCollection, TObject>

AllowNiceNames

If true, the repository allows nice names of the collections, e.g. for "CMS.User" uses "Users"

public bool AllowNiceNames { get; set; }

Property Value

bool

CollectionNames

Returns list of collection names in the repository.

public List<string> CollectionNames { get; }

Property Value

List<string>

CollectionSettings

Table of collection settings [name -> InfoCollectionSettings]

protected StringSafeDictionary<TSettings> CollectionSettings { get; }

Property Value

StringSafeDictionary<TSettings>
See Also

CollectionSettingsByIndex

Table of collection settings by index [index -> InfoCollectionSettings]

protected SafeDictionary<int, TSettings> CollectionSettingsByIndex { get; }

Property Value

SafeDictionary<int, TSettings>
See Also

CollectionSettingsLock

Gets lock object for synchronization of modification of CollectionSettings and CollectionSettingsByIndex.

protected object CollectionSettingsLock { get; }

Property Value

object

Collections

Table of collections [name -> CollectionType]

protected StringSafeDictionary<TCollection> Collections { get; }

Property Value

StringSafeDictionary<TCollection>

CollectionsList

List of all collections (sorted by the order in which the collections were added).

protected List<TCollection> CollectionsList { get; }

Property Value

List<TCollection>

Count

Returns the number of items.

public int Count { get; protected set; }

Property Value

int

DynamicNames

List of the dynamic names of the collections

public IEnumerable<string> DynamicNames { get; set; }

Property Value

IEnumerable<string>

GetDynamicNames

Function that provides the dynamic names of collections to the repository

public Func<IEnumerable<string>> GetDynamicNames { get; set; }

Property Value

Func<IEnumerable<string>>

IsCachedObject

If true, the object is cached within the system for later use

public virtual bool IsCachedObject { get; set; }

Property Value

bool

IsDisconnected

Returns true if this collection is disconnected from the database

public virtual bool IsDisconnected { get; }

Property Value

bool

this[int]

Returns the collection of objects.

public TCollection this[int index] { get; }

Parameters

index int

Index of the collection

Property Value

TCollection

this[string]

Returns the collection of objects indexed by object type, e.g. "cms.user".

public TCollection this[string name] { get; }

Parameters

name string

Name of the inner collection

Property Value

TCollection

ItemsHaveNames

Returns true if the items in the collection have names

public bool ItemsHaveNames { get; }

Property Value

bool

LoadBinaryData

Gets or sets the value which indicates whether to load binary data into the collections.

public virtual bool LoadBinaryData { get; set; }

Property Value

bool

ParentStorage

Parent storage

public ICMSStorage ParentStorage { get; protected set; }

Property Value

ICMSStorage

Properties

Properties of the object available through GetProperty.

public virtual List<string> Properties { get; }

Property Value

List<string>

SortNames

If true, the names in enumeration are sorted

public bool SortNames { get; set; }

Property Value

bool

Methods

Add(params TObject[])

Adds new object to the collection.

public virtual void Add(params TObject[] objects)

Parameters

objects TObject[]

Objects to add

AddCollection(TSettings)

Registers the given collection of objects within the repository.

public virtual TSettings AddCollection(TSettings settings)

Parameters

settings TSettings

Collection settings

Returns

TSettings

Disconnect()

Disconnects the collections from the database

public void Disconnect()

GetCollection(string)

Returns the collection of objects indexed by object type, e.g. "cms.user".

protected virtual TCollection GetCollection(string name)

Parameters

name string

Name of the inner collection

Returns

TCollection

GetEnumerator()

Gets the enumerator for the collection.

public virtual IEnumerator<TCollection> GetEnumerator()

Returns

IEnumerator<TCollection>

GetNicePropertyName(string)

Gets the property name for the original name of the collection

public string GetNicePropertyName(string name)

Parameters

name string

Original name

Returns

string

GetObjectName(object)

Returns the name of the given object

public string GetObjectName(object obj)

Parameters

obj object

Object for which to get the name

Returns

string

GetProperty(string)

Gets the property value.

public virtual object GetProperty(string columnName)

Parameters

columnName string

Column name

Returns

object

LoadCollection(TSettings)

Loads the given collection.

protected abstract TCollection LoadCollection(TSettings settings)

Parameters

settings TSettings

Collection settings

Returns

TCollection

NewCollection(string)

Creates new collection for the data.

public abstract TCollection NewCollection(string type)

Parameters

type string

Type of the collection

Returns

TCollection

NewCombinedCollection()

Creates new combined collection for the data.

public abstract CombinedInfoObjectCollection<TCollection, TObject> NewCombinedCollection()

Returns

CombinedInfoObjectCollection<TCollection, TObject>

Reconnect()

Reconnects the collection to the database

public void Reconnect()

RegisterNiceName(string, string)

Registers the nice name of the collection

protected void RegisterNiceName(string name, string niceName)

Parameters

name string

Name

niceName string

Nice name

ReplaceCollection(TSettings)

Registers the given collection of objects within the repository.

public TSettings ReplaceCollection(TSettings settings)

Parameters

settings TSettings

Collection settings

Returns

TSettings

SetupCollection(TCollection, TSettings)

Sets up the collection using the given settings

protected void SetupCollection(TCollection collection, TSettings setttings)

Parameters

collection TCollection

Collection to set

setttings TSettings

Collection settings

StoreCollection(TCollection, InfoCollectionSettings)

Stores the collection into inner lists

protected void StoreCollection(TCollection collection, InfoCollectionSettings settings)

Parameters

collection TCollection

Collection to store

settings InfoCollectionSettings

Collection settings

SubmitChanges()

Submits the changes to the database.

public void SubmitChanges()

TryGetProperty(string, out object)

Returns value of property.

public virtual bool TryGetProperty(string columnName, out object value)

Parameters

columnName string

Column name

value object

Returns the value

Returns

bool

Returns true if the operation was successful (the value was present)

Events

OnLoadCollection

Fires when the collection with specified name is requested.

public event InfoObjectRepository<TCollection, TObject, TSettings>.LoadCollectionHandler OnLoadCollection

Event Type

InfoObjectRepository<TCollection, TObject, TSettings>.LoadCollectionHandler