Table of Contents

Class BaseInfo.GeneralizedInfoWrapper

Namespace
CMS.DataEngine
Assembly
CMS.DataEngine.dll

Info object wrapper for generalized access

public abstract class BaseInfo.GeneralizedInfoWrapper : ICMSObject, IHierarchicalDataContainer, IDataContainer, ISimpleDataContainer, IVirtualHierarchicalObject, IHierarchicalObject, INameIndexable, ICMSStorage
Inheritance
object
BaseInfo.GeneralizedInfoWrapper
Implements
Derived
Extension Methods

Constructors

GeneralizedInfoWrapper(BaseInfo)

Constructor

protected GeneralizedInfoWrapper(BaseInfo mainObj)

Parameters

mainObj BaseInfo

Main object to wrap

Properties

CheckUnique

If true, the code name is checked for uniqueness upon saving.

public bool CheckUnique { get; set; }

Property Value

bool

CodeNameColumn

Code name column name of the info record.

public string CodeNameColumn { get; }

Property Value

string

ColumnNames

Column names.

public List<string> ColumnNames { get; }

Property Value

List<string>

DisplayNameColumn

Code name column name of the info record.

public string DisplayNameColumn { get; }

Property Value

string

HasData

Returns true if the object has it's data storage initialized already

public bool HasData { get; }

Property Value

bool

IsCachedObject

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

public bool IsCachedObject { get; set; }

Property Value

bool

IsComplete

Returns true if the object is complete (has all columns).

public virtual bool IsComplete { get; }

Property Value

bool

IsDisconnected

Returns true if the object is disconnected from the data source

public bool IsDisconnected { get; }

Property Value

bool

IsObjectValid

Returns true if the object is considered valid.

public bool IsObjectValid { get; }

Property Value

bool

this[string]

Gets or sets the value of the column.

public object this[string columnName] { get; set; }

Parameters

columnName string

Column name

Property Value

object

LogEvents

If true, events are logged on the object update.

public bool LogEvents { get; set; }

Property Value

bool

LogWebFarmTasks

If true, web farm tasks are logged on the object update.

public bool LogWebFarmTasks { get; set; }

Property Value

bool

MainObject

Main object for this general access object

public virtual BaseInfo MainObject { get; protected set; }

Property Value

BaseInfo

ObjectCategory

Object category.

public BaseInfo ObjectCategory { get; }

Property Value

BaseInfo

ObjectCodeName

Object code name.

public string ObjectCodeName { get; set; }

Property Value

string

ObjectDisplayName

Object name.

public string ObjectDisplayName { get; set; }

Property Value

string

ObjectFullName

Object full name if exists

public string ObjectFullName { get; }

Property Value

string

ObjectGUID

Object GUID.

public Guid ObjectGUID { get; set; }

Property Value

Guid

ObjectID

Object ID.

public int ObjectID { get; set; }

Property Value

int

ObjectOrder

Returns the order of the object among the other objects.

public virtual int ObjectOrder { get; }

Property Value

int

ObjectParent

Object parent

public BaseInfo ObjectParent { get; set; }

Property Value

BaseInfo

ObjectParentID

Object parent ID.

public int ObjectParentID { get; set; }

Property Value

int

OriginalObjectCodeName

Returns the original object code name

public virtual string OriginalObjectCodeName { get; }

Property Value

string

ParentObjectType

Parent object type.

public string ParentObjectType { get; }

Property Value

string

Properties

Properties of the object available through GetProperty.

public List<string> Properties { get; }

Property Value

List<string>

TouchCacheDependencies

If true, cache dependencies are touched when the object is changed.

public bool TouchCacheDependencies { get; set; }

Property Value

bool

TypeInfo

Type info.

public ObjectTypeInfo TypeInfo { get; }

Property Value

ObjectTypeInfo

ValidateCodeName

If true, the code name is validated upon saving.

public bool ValidateCodeName { get; set; }

Property Value

bool

Methods

AnyItemChanged(IEnumerable<string>)

Returns true if any of the specified column names has changed.

public bool AnyItemChanged(IEnumerable<string> columnNames)

Parameters

columnNames IEnumerable<string>

Column names

Returns

bool

CheckUniqueCodeName()

Checks if the object has unique code name. Returns true if the object has unique code name.

public bool CheckUniqueCodeName()

Returns

bool

ContainsColumn(string)

Returns true if the object contains specified column.

public bool ContainsColumn(string columnName)

Parameters

columnName string

Column name

Returns

bool

DeleteData()

Deletes the object from the database.

public virtual void DeleteData()

DeleteDataAsync(CancellationToken)

Asynchronously deletes the object from the database.

public virtual Task DeleteDataAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

The cancellation instruction.

Returns

Task

DeleteObject()

Deletes the object using appropriate provider.

public void DeleteObject()

Disconnect()

Disconnects the object from database.

public void Disconnect()

EnsureBinaryData()

Makes sure that the binary data is loaded into binary column of the object when StoreToFileSystem is true.

public byte[] EnsureBinaryData()

Returns

byte[]

EnsureCodeName()

Ensures the code name of the object if not set

public void EnsureCodeName()

EnsureUniqueCodeName()

Ensures that the object has a unique code name within it's context

public void EnsureUniqueCodeName()

ExportDefaultData(string, IEnumerable<string>)

Exports the default object installation data

public virtual void ExportDefaultData(string filePath, IEnumerable<string> excludedNames = null)

Parameters

filePath string

File path for the export

excludedNames IEnumerable<string>

Objects with display names and code names starting with these expressions are filtered out.

GetCacheDependencies()

Gets collection of dependency keys to be touched when modifying the current object.

public ICollection<string> GetCacheDependencies()

Returns

ICollection<string>

GetColumnType(string)

Gets the column type.

public virtual Type GetColumnType(string columnName)

Parameters

columnName string

Column name

Returns

Type

GetDataQuery(bool, Action<DataQuerySettings>)

Gets the data query for this object type

public IDataQuery GetDataQuery(bool includeTypeCondition, Action<DataQuerySettings> parameters)

Parameters

includeTypeCondition bool

If true, the type condition is included, otherwise selects all data from the data source.

parameters Action<DataQuerySettings>

Parameters for the data retrieval.

Returns

IDataQuery

GetDependenciesNames(bool, int)

Returns a list of object names which depend on this object. First tries to execute checkdependencies query, if not found, an automatic process is executed.

public List<string> GetDependenciesNames(bool reportAll = false, int topN = 10)

Parameters

reportAll bool

If false, only required dependency constraints (without default value) are returned, otherwise checks all dependency relations.

topN int

Number of dependent objects to return, 0 means no limitation.

Returns

List<string>

Remarks

Automated process is based on DependsOn property. Child objects are not included. Objects whose ObjectPathSettings value contains a prefix matching the current object's path value are also not included.

GetExisting()

Returns the existing object based on current object data.

public BaseInfo GetExisting()

Returns

BaseInfo

GetLastObjectOrder(string)

Returns number which will be the last order within all the other items (according to Parent settings).

public int GetLastObjectOrder(string orderColumn = null)

Parameters

orderColumn string

Name of the order column. If null, OrderColumn from TypeInfo is taken

Returns

int

GetLockObject()

Gets the global lock object for all the instances of the object (locked on "objectType_objectId").

public object GetLockObject()

Returns

object

GetObject(int)

Gets the object by its ID.

public BaseInfo GetObject(int objectId)

Parameters

objectId int

Object ID

Returns

BaseInfo

GetObjectKey()

Gets the unique string key for the object.

public string GetObjectKey()

Returns

string

GetOriginalValue(string)

Returns the original value of column.

public virtual object GetOriginalValue(string columnName)

Parameters

columnName string

Column name

Returns

object

GetProperty(string)

Returns property with given name (either object or property value).

public object GetProperty(string columnName)

Parameters

columnName string

Column name

Returns

object

GetPropertyType(string)

Gets the type of the given property

public Type GetPropertyType(string propertyName)

Parameters

propertyName string

Property name

Returns

Type

GetUniqueCodeName()

Returns the unique code name generated from current object code name.

public string GetUniqueCodeName()

Returns

string

GetUniqueDisplayName(bool)

Returns the unique display name generated from current object display name.

public string GetUniqueDisplayName(bool ensureLength = true)

Parameters

ensureLength bool

If true, maximal display name length is ensured

Returns

string

GetValue(string)

Returns value of column.

public object GetValue(string columnName)

Parameters

columnName string

Column name

Returns

object

InitObjectsOrder(string)

Initializes the proper order of the sibling objects so the order column is consistent.

public void InitObjectsOrder(string orderColumn = null)

Parameters

orderColumn string

Name of the column that is used for storing the object's order. If null, OrderColumn is taken from TypeInfo.

InsertAsClone(CloneSettings)

Inserts the object as a new object to the DB with inner data and structure (according to given settings) cloned from the original.

public BaseInfo InsertAsClone(CloneSettings settings)

Parameters

settings CloneSettings

Cloning settings

Returns

BaseInfo

Returns the newly created clone

InsertAsClone(CloneSettings, CloneResult)

Inserts the object as a new object to the DB with inner data and structure (according to given settings) cloned from the original.

public BaseInfo InsertAsClone(CloneSettings settings, CloneResult result)

Parameters

settings CloneSettings

Cloning settings

result CloneResult

Result of the cloning - messages in this object will be altered by processing this method

Returns

BaseInfo

Returns the newly created clone

InsertData()

Inserts the object to the database.

public virtual void InsertData()

InsertDataAsync(CancellationToken)

Asynchronously inserts the object to the database.

public virtual Task InsertDataAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

The cancellation instruction.

Returns

Task

Invalidate(bool)

Invalidates the object in the object table.

public void Invalidate(bool keepThisInstanceValid)

Parameters

keepThisInstanceValid bool

If true, this object is marked as updated to behave as valid

IsChildOf(BaseInfo)

Returns true if the object is child of the given object. If parameter parent is null, returns true only if the object is not a child of any object.

public bool IsChildOf(BaseInfo parent)

Parameters

parent BaseInfo

Parent to check

Returns

bool

ItemChanged(string)

Returns true if the item on specified column name changed.

public bool ItemChanged(string columnName)

Parameters

columnName string

Column name

Returns

bool

MakeComplete(bool)

Makes the object data complete.

public void MakeComplete(bool loadFromDb)

Parameters

loadFromDb bool

If true, the data to complete the object is loaded from database

MoveObjectDown(string)

Moves the object down within the object order (if OrderColumn is specified). The move is done within the object's parent (if defined).

public void MoveObjectDown(string orderColumn = null)

Parameters

orderColumn string

Name of the order column. If null, OrderColumn from TypeInfo is taken

MoveObjectUp(string)

Moves the object up within the object order (if OrderColumn is specified). The move is done within the object's parent (if defined).

public void MoveObjectUp(string orderColumn = null)

Parameters

orderColumn string

Name of the order column. If null, OrderColumn from TypeInfo is taken

NewObject(LoadDataSettings)

Creates new object of the given class

public BaseInfo NewObject(LoadDataSettings settings)

Parameters

settings LoadDataSettings

Data settings

Returns

BaseInfo

NotSupported()

Throws the not supported exception

protected void NotSupported()

Reconnect()

Reconnects the object to database.

public void Reconnect()

ResetChanges()

Resets the object changes and keeps the new values as unchanged.

public virtual void ResetChanges()

RevertChanges()

Reverts the object changes to the original values.

public virtual void RevertChanges()

SetObject()

Updates the object using appropriate provider.

public void SetObject()

SetObjectAlphabeticalOrder(string, string)

Moves the object to the right position according to the custom order.

public void SetObjectAlphabeticalOrder(string orderColumn = null, string nameColumn = null)

Parameters

orderColumn string

Name of the order column. If null, OrderColumn from TypeInfo is taken

nameColumn string

Column by the content of which the alphabetical order will be set

SetObjectOrder(int, bool, string)

Moves the object to the specified order (if OrderColumn is specified). The move is done within the object's parent (if defined).

public void SetObjectOrder(int targetOrder, bool relativeOrder = false, string orderColumn = null)

Parameters

targetOrder int

Desired order of the object

relativeOrder bool

If true, the targetOrder parameter is taken as a relative order from current order position

orderColumn string

Name of the order column. If null, OrderColumn from TypeInfo is taken

SetValue(string, object)

Sets value of column.

public bool SetValue(string columnName, object value)

Parameters

columnName string

Column name

value object

Column value

Returns

bool

SortAlphabetically(bool, string, string)

Moves the object to the right position according to the custom order.

public void SortAlphabetically(bool asc = true, string orderColumn = null, string nameColumn = null)

Parameters

asc bool

Indicates whether the order is ascending or descending (ascending by default).

orderColumn string

Name of the column that is used for storing the object's order. If null, OrderColumn is taken from TypeInfo.

nameColumn string

Name of the column by which the alphabetical order is to be set.

SubmitChanges(bool)

Submits the changes in the object to the database.

public void SubmitChanges(bool withCollections)

Parameters

withCollections bool

If true, also submits the changes in the underlying collections of the object (Children, ChildDependencies, Bindings, OtherBindings)

TryGetProperty(string, out object)

Returns property with given name (either object or property value).

public 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)

TryGetProperty(string, out object, bool)

Returns value of property.

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

Parameters

columnName string

Column name

value object

Returns the value

notNull bool

If true, the property attempts to return non-null values, at least it returns the empty object of the correct type

Returns

bool

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

TryGetValue(string, out object)

Returns value of column.

public bool TryGetValue(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)

UpdateData()

Updates the object in the database.

public virtual void UpdateData()

UpdateDataAsync(CancellationToken)

Asynchronously updates the object in the database.

public virtual Task UpdateDataAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

The cancellation instruction.

Returns

Task