Class InfoObjectCollection<TInfo>
- Namespace
- CMS.DataEngine
- Assembly
- CMS.DataEngine.dll
Generic info object collection.
public class InfoObjectCollection<TInfo> : AbstractHierarchicalObject<InfoObjectCollection<TInfo>>, IDataContainer, ISimpleDataContainer, IVirtualHierarchicalObject, IHierarchicalObject, IInfoObjectCollection<TInfo>, IInfoObjectCollection, IVirtualTypedCollection, ICMSQueryable<TInfo>, ICMSQueryable, INamedEnumerable<TInfo>, INamedEnumerable, IIndexable<TInfo>, INameIndexable<TInfo>, INameIndexable, IIndexable where TInfo : BaseInfo
Type Parameters
TInfo
- Inheritance
-
objectInfoObjectCollection<TInfo>
- Implements
-
IInfoObjectCollection<TInfo>ICMSQueryable<TInfo>INamedEnumerable<TInfo>IIndexable<TInfo>INameIndexable<TInfo>
- Derived
- Inherited Members
- Extension Methods
Constructors
InfoObjectCollection()
Constructor
public InfoObjectCollection()
InfoObjectCollection(DataSet)
Constructor. Creates a static collection populated from DataSet
public InfoObjectCollection(DataSet sourceData)
Parameters
sourceData
DataSetSource DataSet
InfoObjectCollection(string)
Constructor
protected InfoObjectCollection(string objectType)
Parameters
objectType
stringObject type
Fields
ObjectInitializer
Provides a way how to initialize the object instance based on given data
public Func<DataRow, TInfo> ObjectInitializer
Field Value
- Func<DataRow, TInfo>
Properties
AllowPaging
If true, the paging of the data is allowed (data is loaded in batches).
public bool AllowPaging { get; set; }
Property Value
- bool
AutomaticNameColumn
If true, the automatic name column is used within this collection
protected bool AutomaticNameColumn { get; set; }
Property Value
- bool
CodeNames
Collection of the object code names
public CollectionPropertyWrapper<BaseInfo> CodeNames { get; }
Property Value
Columns
Columns to get.
public string Columns { get; set; }
Property Value
- string
Count
Returns the number of items.
public int Count { get; }
Property Value
- int
DeletedItems
Returns the items collection.
protected List<TInfo> DeletedItems { get; set; }
Property Value
- List<TInfo>
DisplayNames
Collection of the object display names
public CollectionPropertyWrapper<BaseInfo> DisplayNames { get; }
Property Value
DynamicWhereCondition
Dynamic where condition.
public Func<string> DynamicWhereCondition { get; set; }
Property Value
- Func<string>
ElementType
Returns the element type.
public Type ElementType { get; }
Property Value
- Type
EnforceReadOnlyDataAccess
If true, the read only access to the data is enforced within the transaction.
public virtual bool EnforceReadOnlyDataAccess { get; set; }
Property Value
- bool
Expression
Query expression
public Expression Expression { get; }
Property Value
- Expression
FieldsAsObjects
Related objects wrappers
public CollectionPropertyTransformation<IInfoObjectCollection> FieldsAsObjects { get; }
Property Value
FirstItem
Returns the first item of the collection
public TInfo FirstItem { get; }
Property Value
- TInfo
GUIDs
Collection of the object GUIDs
public CollectionPropertyWrapper<BaseInfo> GUIDs { get; }
Property Value
IDs
Collection of the object IDs
public CollectionPropertyWrapper<BaseInfo> IDs { get; }
Property Value
InternalCount
Internal count of the items
protected int InternalCount { get; }
Property Value
- int
IsCachedObject
If true, the object is cached within the system for later use
public bool IsCachedObject { get; set; }
Property Value
- bool
IsDisconnected
Returns true if the collection is disconnected from the data source
public virtual bool IsDisconnected { get; }
Property Value
- bool
IsLastVersion
If true, the document is the last version (retrieved using DocumentHelper.GetDocument).
public virtual bool IsLastVersion { get; set; }
Property Value
- bool
IsOffline
Returns true, if the collection is offline (not backed up by the database but by the source data)
public bool IsOffline { get; }
Property Value
- bool
this[int]
Gets or sets the object on specific index.
public TInfo this[int index] { get; set; }
Parameters
index
intObject index to get
Property Value
- TInfo
this[string]
Returns the object registered by the specific name.
public TInfo this[string name] { get; set; }
Parameters
name
stringObject name (indexer)
Property Value
- TInfo
Items
Returns the items collection.
protected virtual List<TInfo> Items { get; }
Property Value
- List<TInfo>
ItemsAsFields
Fields wrappers
public CollectionPropertyTransformation<CollectionPropertyWrapper<BaseInfo>> ItemsAsFields { get; }
Property Value
ItemsHaveNames
Returns true if the items in the collection have names
public bool ItemsHaveNames { get; }
Property Value
- bool
LastItem
Returns the last item of the collection
public TInfo LastItem { get; }
Property Value
- TInfo
LoadBinaryData
Gets or sets the value which indicates whether to load binary data into the collections.
public bool LoadBinaryData { get; set; }
Property Value
- bool
Name
Collection name. Returns object type if name is not defined
public string Name { get; set; }
Property Value
- string
NameColumn
Name column name
public virtual string NameColumn { get; set; }
Property Value
- string
NewItems
Returns the items collection.
protected List<TInfo> NewItems { get; set; }
Property Value
- List<TInfo>
Object
Object instance of the specified type.
public virtual BaseInfo Object { get; set; }
Property Value
ObjectType
Returns the object type of the objects stored within the collection.
public virtual string ObjectType { get; }
Property Value
- string
ObjectsByName
Objects by name collection.
protected virtual Hashtable ObjectsByName { get; }
Property Value
- Hashtable
OrderByColumns
Order by expression.
public string OrderByColumns { get; set; }
Property Value
- string
PageSize
Page size for loading of the items.
public int PageSize { get; set; }
Property Value
- int
ParentObject
Parent object. Instance of object which contains this collection as it's inner field.
public virtual BaseInfo ParentObject { get; set; }
Property Value
ParentStorage
Parent storage
public ICMSStorage ParentStorage { get; protected set; }
Property Value
Provider
Query provider
public IQueryProvider Provider { get; }
Property Value
- IQueryProvider
RemovedObject
Defines the removed object within collection
protected TInfo RemovedObject { get; }
Property Value
- TInfo
SortNames
If true, the names in enumeration are sorted
public bool SortNames { get; set; }
Property Value
- bool
SourceData
Source data for the collection
public DataSet SourceData { get; set; }
Property Value
- DataSet
TopN
Select top N objects.
public int TopN { get; set; }
Property Value
- int
TypeInfo
Type info for the collection object.
public virtual ObjectTypeInfo TypeInfo { get; }
Property Value
UseDefaultCacheDependencies
If true, the collection uses default cache dependencies to flush it's content
public bool UseDefaultCacheDependencies { get; set; }
Property Value
- bool
UseObjectTypeCondition
If true, the collection uses the type condition to get the data
public bool UseObjectTypeCondition { get; set; }
Property Value
- bool
Where
Where condition.
public WhereCondition Where { get; set; }
Property Value
Methods
Add(params BaseInfo[])
Adds new object to the collection.
public virtual void Add(params BaseInfo[] objects)
Parameters
objects
BaseInfo[]Objects to add
Add(IEnumerable<BaseInfo>)
Adds new object to the collection.
public void Add(IEnumerable<BaseInfo> objects)
Parameters
objects
IEnumerable<BaseInfo>Object to add
AddCacheDependencies(params string[])
Adds the given list of cache dependencies to the collection
public virtual void AddCacheDependencies(params string[] keys)
Parameters
keys
string[]Keys to add
As<TType>()
Makes a wrapper of the collection with specified type of the items.
public virtual IQueryable<TType> As<TType>() where TType : BaseInfo
Returns
- IQueryable<TType>
Type Parameters
TType
Target type of the items
CacheDependenciesChanged()
Ensures the actions when the cache dependencies have changed
protected void CacheDependenciesChanged()
ChangeParent(BaseInfo, ICMSStorage)
Changes the parent of the collection
public void ChangeParent(BaseInfo parentObject, ICMSStorage parentStorage)
Parameters
parentObject
BaseInfoParent object
parentStorage
ICMSStorageParent storage
Clear()
Clears the current items in the collection.
public virtual void Clear()
ClearCache()
Clears the collection cache
public void ClearCache()
ClearCacheCallback(IInfoObjectCollection, object)
Clears the collection cache
protected static void ClearCacheCallback(IInfoObjectCollection col, object parameter)
Parameters
col
IInfoObjectCollectionTarget collection
parameter
objectCallback parameter
Clone()
Creates the clone of the collection.
public virtual IInfoObjectCollection<TInfo> Clone()
Returns
- IInfoObjectCollection<TInfo>
CloneCollection()
Creates the clone of this collection.
public IInfoObjectCollection CloneCollection()
Returns
CompareTo(object)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(object obj)
Parameters
obj
objectObject to compare
Returns
- int
CopyItemsTo(IInfoObjectCollection)
Copies the items of this collection to the other collection
protected void CopyItemsTo(IInfoObjectCollection targetCollection)
Parameters
targetCollection
IInfoObjectCollection
CopyPropertiesTo(IInfoObjectCollection)
Copies the properties of this collection to the other collection
protected virtual void CopyPropertiesTo(IInfoObjectCollection targetCollection)
Parameters
targetCollection
IInfoObjectCollectionTarget collection
CreateChild(IDataQuerySettings)
Creates the child collection based on the given provider
public ICMSQueryable<TInfo> CreateChild(IDataQuerySettings settings)
Parameters
settings
IDataQuerySettingsQuery parameters
Returns
- ICMSQueryable<TInfo>
CreateNewObject(DataRow)
Creates new instance of the encapsulated object.
public virtual TInfo CreateNewObject(DataRow dr)
Parameters
dr
DataRowDataRow with the data
Returns
- TInfo
CreateQueryProvider()
Creates a LINQ query provider for this collection
protected IQueryProvider CreateQueryProvider()
Returns
- IQueryProvider
Disconnect()
Disconnects the collection from the database
public void Disconnect()
Dispose()
Disposes the object
public void Dispose()
EnsureItems(int)
Ensures the specified number of items in the item list.
protected void EnsureItems(int count)
Parameters
count
intNumber of items
EnsureObjectValues(BaseInfo)
Ensures the proper values for the given object
protected virtual void EnsureObjectValues(BaseInfo item)
Parameters
item
BaseInfoItem in which ensure the values
GetCacheDependencyKeys()
Gets the list of cache dependency keys on which this collection depends
protected virtual List<string> GetCacheDependencyKeys()
Returns
- List<string>
GetCompleteWhereCondition()
Gets the complete where condition for the collection
public virtual WhereCondition GetCompleteWhereCondition()
Returns
GetData(IWhereCondition, int, int, ref int)
Gets the data for the collection.
protected virtual DataSet GetData(IWhereCondition where, int offset, int maxRecords, ref int totalRecords)
Parameters
where
IWhereConditionWhere condition
offset
intStarting offset for the data
maxRecords
intMaximum number of records to get
totalRecords
intReturning total number of records
Returns
- DataSet
GetEmptyObject()
Gets an empty object for this collection
public object GetEmptyObject()
Returns
- object
GetEnumerator()
Gets the enumerator for the collection
public IEnumerator<TInfo> GetEnumerator()
Returns
- IEnumerator<TInfo>
GetEnumeratorInternal()
Gets the enumerator for the collection.
public IEnumerator<TInfo> GetEnumeratorInternal()
Returns
- IEnumerator<TInfo>
GetFieldsAsObjects(string)
Gets the collection of objects that are referenced by the given property
public IInfoObjectCollection GetFieldsAsObjects(string propertyName)
Parameters
propertyName
stringProperty name
Returns
GetFieldsAsObjects(string, string)
Gets the collection of objects that are referenced by the given property
protected IInfoObjectCollection GetFieldsAsObjects(string propertyName, string objectType)
Parameters
propertyName
stringProperty name
objectType
stringObject type of the target objects
Returns
GetItem(int)
Gets the item on the specified index.
protected TInfo GetItem(int index)
Parameters
index
intItem index to get
Returns
- TInfo
GetItemsAsFields(string)
Returns the updatable collection of fields of collection items
public CollectionPropertyWrapper<BaseInfo> GetItemsAsFields(string propertyName)
Parameters
propertyName
stringName of the properties to extract
Returns
GetNameWhereCondition(string)
Gets the where condition for the given object name.
public virtual IWhereCondition GetNameWhereCondition(string name)
Parameters
name
stringObject name
Returns
GetObjectByNameInternal(string)
Gets the object by its name, internal representation that gets data from database
protected virtual TInfo GetObjectByNameInternal(string name)
Parameters
name
stringName of the object
Returns
- TInfo
GetObjectName(object)
Gets the unique object name from the given object.
public string GetObjectName(object obj)
Parameters
obj
objectObject
Returns
- string
GetObjectName(TInfo)
Gets the unique object name from the given object.
public virtual string GetObjectName(TInfo obj)
Parameters
obj
TInfoObject
Returns
- string
GetSubsetOrderBy(string)
Returns the clone of the collection with specified order by applied
public virtual IInfoObjectCollection GetSubsetOrderBy(string orderBy)
Parameters
orderBy
stringOrder By expression
Returns
Init(string)
Initializes the collection to use specific object type
protected void Init(string objectType)
Parameters
objectType
stringObject type to use
Load(IEnumerable<BaseInfo>)
Clears the data in the collection and loads objects from the given list.
public virtual void Load(IEnumerable<BaseInfo> objects)
Parameters
objects
IEnumerable<BaseInfo>Objects data to load
MakeEmpty()
Makes the collection empty.
public void MakeEmpty()
Reconnect()
Reconnects the collection to the database
public void Reconnect()
RegisterClearCacheCallback()
Registers the callback to clear the collection cache
protected void RegisterClearCacheCallback()
RegisterColumns()
Registers the Columns of this object
protected override void RegisterColumns()
RegisterProperties()
Registers the properties of this object
protected override void RegisterProperties()
RegisterProperties(List<string>)
Registers supported properties
public virtual void RegisterProperties(List<string> properties)
Parameters
properties
List<string>List with supported properties
Remove(IEnumerable<TInfo>)
Removes the specified object from the collection.
public void Remove(IEnumerable<TInfo> objects)
Parameters
objects
IEnumerable<TInfo>Object to remove
Remove(params TInfo[])
Removes the specified object from the collection.
public virtual void Remove(params TInfo[] objects)
Parameters
objects
TInfo[]Object to remove
RemoveClearCacheCallback()
Removes the callback to clear the collection cache
protected void RemoveClearCacheCallback()
SubmitChanges()
Submits the changes in the collection to the database.
public virtual void SubmitChanges()
ToString()
Provides a string representation of the collection
public override string ToString()
Returns
- string
ValidateItem(BaseInfo, bool)
Validates whether the item can be member of the collection (collection can work with it). Returns true if item is valid.
protected bool ValidateItem(BaseInfo item, bool throwException = true)
Parameters
item
BaseInfoItem to validate
throwException
boolIf true, the method throws exception in case validation fails
Returns
- bool