Show / Hide Table of Contents

Class Entity

Provides instance of entity.

Inheritance
System.Object
Entity
SysEmpty
SystemEntity
Implements
IEntity
System.ICloneable
ILicObject
ICompositeObject
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Terrasoft.Core.Entities
Assembly: Terrasoft.Core.dll
Syntax
public class Entity : IEntity, ICloneable, ILicObject, ICompositeObject, IRowModel

Constructors

Entity(Entity)

Creates an object that represents a record in the database table.

Declaration
public Entity(Entity source)
Parameters
Type Name Description
Entity source

Unique identifier of the entity schema.

Entity(UserConnection)

Creates an object that represents a record in the database table.

Declaration
public Entity(UserConnection userConnection)
Parameters
Type Name Description
UserConnection userConnection

User connection.

Entity(UserConnection, Guid)

Creates an object that represents a record in the database table.

Declaration
public Entity(UserConnection userConnection, Guid schemaUId)
Parameters
Type Name Description
UserConnection userConnection

User connection.

System.Guid schemaUId

Unique identifier of the entity schema.

Properties

ChangeType

Declaration
public EntityChangeType ChangeType { get; set; }
Property Value
Type Description
EntityChangeType

EntitySchemaManager

Declaration
public EntitySchemaManager EntitySchemaManager { get; }
Property Value
Type Description
EntitySchemaManager

EntitySchemaManagerName

Declaration
public string EntitySchemaManagerName { get; set; }
Property Value
Type Description
System.String

HasColumnValues

Declaration
public bool HasColumnValues { get; }
Property Value
Type Description
System.Boolean

HierarchyColumnValue

Declaration
public Guid HierarchyColumnValue { get; set; }
Property Value
Type Description
System.Guid

InstanceUId

Declaration
public Guid InstanceUId { get; }
Property Value
Type Description
System.Guid

IsDeletedFromDB

Declaration
public bool IsDeletedFromDB { get; }
Property Value
Type Description
System.Boolean

IsInColumnValueChanged

Declaration
public bool IsInColumnValueChanged { get; }
Property Value
Type Description
System.Boolean

IsInColumnValueChanging

Declaration
public bool IsInColumnValueChanging { get; }
Property Value
Type Description
System.Boolean

IsInDefColumnValuesSet

Declaration
public bool IsInDefColumnValuesSet { get; }
Property Value
Type Description
System.Boolean

IsInDeleted

Declaration
public bool IsInDeleted { get; }
Property Value
Type Description
System.Boolean

IsInDeleting

Declaration
public bool IsInDeleting { get; }
Property Value
Type Description
System.Boolean

IsInInserted

Declaration
public bool IsInInserted { get; }
Property Value
Type Description
System.Boolean

IsInInserting

Declaration
public bool IsInInserting { get; }
Property Value
Type Description
System.Boolean

IsInLoaded

Declaration
public bool IsInLoaded { get; }
Property Value
Type Description
System.Boolean

IsInLoading

Declaration
public bool IsInLoading { get; }
Property Value
Type Description
System.Boolean

IsInSaved

Declaration
public bool IsInSaved { get; }
Property Value
Type Description
System.Boolean

IsInSaveError

Declaration
public bool IsInSaveError { get; }
Property Value
Type Description
System.Boolean

IsInSaving

Declaration
public bool IsInSaving { get; }
Property Value
Type Description
System.Boolean

IsInUpdated

Declaration
public bool IsInUpdated { get; }
Property Value
Type Description
System.Boolean

IsInUpdating

Declaration
public bool IsInUpdating { get; }
Property Value
Type Description
System.Boolean

IsInValidating

Declaration
public bool IsInValidating { get; }
Property Value
Type Description
System.Boolean

IsSchemaInitialized

Declaration
public bool IsSchemaInitialized { get; }
Property Value
Type Description
System.Boolean

LicOperationPrefix

Declaration
public string LicOperationPrefix { get; }
Property Value
Type Description
System.String

LoadState

Declaration
public EntityLoadState LoadState { get; }
Property Value
Type Description
EntityLoadState

LookupColumnEntities

Declaration
public LookupColumnEntityDictionary LookupColumnEntities { get; }
Property Value
Type Description
LookupColumnEntityDictionary

PrimaryColumnValue

Declaration
public Guid PrimaryColumnValue { get; set; }
Property Value
Type Description
System.Guid

PrimaryDisplayColumnValue

Declaration
public string PrimaryDisplayColumnValue { get; set; }
Property Value
Type Description
System.String

Process

Declaration
public Process Process { get; protected set; }
Property Value
Type Description
Process

RecordInactive

Declaration
public bool RecordInactive { get; set; }
Property Value
Type Description
System.Boolean

Schema

Declaration
public EntitySchema Schema { get; set; }
Property Value
Type Description
EntitySchema

SchemaName

Declaration
public string SchemaName { get; set; }
Property Value
Type Description
System.String

StoringState

Declaration
public StoringObjectState StoringState { get; set; }
Property Value
Type Description
StoringObjectState

UseAdminRights

Determines whether to take into account rights to insert, update, delete and select data.

Declaration
public bool UseAdminRights { get; set; }
Property Value
Type Description
System.Boolean
Remarks

Default value is true.

UseDefRights

Declaration
public bool UseDefRights { get; set; }
Property Value
Type Description
System.Boolean

UseLazyLoad

Declaration
public bool UseLazyLoad { get; set; }
Property Value
Type Description
System.Boolean

UserConnection

Declaration
public UserConnection UserConnection { get; set; }
Property Value
Type Description
UserConnection

ValidationMessages

Declaration
public EntityValidationMessageCollection ValidationMessages { get; }
Property Value
Type Description
EntityValidationMessageCollection

ValueListSchemaManager

Declaration
public ValueListSchemaManager ValueListSchemaManager { get; }
Property Value
Type Description
ValueListSchemaManager

ValueListSchemaManagerName

Declaration
public string ValueListSchemaManagerName { get; set; }
Property Value
Type Description
System.String

Methods

AddDefRights()

Declaration
public void AddDefRights()

AddDefRights(IEnumerable<Guid>)

Declaration
public void AddDefRights(IEnumerable<Guid> primaryColumnValues)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<System.Guid> primaryColumnValues

AddDefRights(Guid)

Declaration
public void AddDefRights(Guid primaryColumnValue)
Parameters
Type Name Description
System.Guid primaryColumnValue

AddLicOperations(ICollection<String>)

Declaration
public void AddLicOperations(ICollection<string> operations)
Parameters
Type Name Description
System.Collections.Generic.ICollection<System.String> operations

Clone()

Declaration
public virtual object Clone()
Returns
Type Description
System.Object

CreateInsert(Boolean)

Declaration
public Insert CreateInsert(bool skipLookupColumnValues = false)
Parameters
Type Name Description
System.Boolean skipLookupColumnValues
Returns
Type Description
Insert

CreateLookupDisplayValuesSelect(IEnumerable<EntitySchemaColumn>)

Declaration
protected Select CreateLookupDisplayValuesSelect(IEnumerable<EntitySchemaColumn> columns)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<EntitySchemaColumn> columns
Returns
Type Description
Select

CreateUpdate(Boolean)

Declaration
public Update CreateUpdate(bool skipLookupColumnValues = false)
Parameters
Type Name Description
System.Boolean skipLookupColumnValues
Returns
Type Description
Update

Delete()

Deletes the entity.

Declaration
public virtual bool Delete()
Returns
Type Description
System.Boolean

Boolean value that indicates successfully deleted entity.

Delete(Boolean)

Deletes the entity.

Declaration
public virtual bool Delete(bool trackChanges)
Parameters
Type Name Description
System.Boolean trackChanges

Indicates whether to track changes.

Returns
Type Description
System.Boolean

Boolean value that indicates successfully deleted entity.

Delete(Object)

Deletes entity.

Declaration
public virtual bool Delete(object keyValue)
Parameters
Type Name Description
System.Object keyValue

The key value.

Returns
Type Description
System.Boolean

True if entity was deleted, otherwise False.

Delete(Object, Boolean)

Deletes entity.

Declaration
public virtual bool Delete(object keyValue, bool trackChanges)
Parameters
Type Name Description
System.Object keyValue

The key value.

System.Boolean trackChanges

Indicates whether to track changes.

Returns
Type Description
System.Boolean

True if entity was deleted, otherwise False.

DeleteWithCancelProcess()

Deletes entity and after delete cancels running process.

Declaration
public bool DeleteWithCancelProcess()
Returns
Type Description
System.Boolean

Flag that indicates successfully deleted entity or not.

DeserializeFromJson(UserConnection, String)

Declaration
public static Entity DeserializeFromJson(UserConnection userConnection, string jsonValue)
Parameters
Type Name Description
UserConnection userConnection
System.String jsonValue
Returns
Type Description
Entity

Equals(Object)

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.Boolean
Overrides
System.Object.Equals(System.Object)

ExecuteDelete(Delete, Object)

Declaration
protected virtual bool ExecuteDelete(Delete delete, object keyValue)
Parameters
Type Name Description
Delete delete
System.Object keyValue
Returns
Type Description
System.Boolean

ExecuteDeleteAsync(Delete, Object)

Declaration
protected virtual Task<bool> ExecuteDeleteAsync(Delete delete, object keyValue)
Parameters
Type Name Description
Delete delete
System.Object keyValue
Returns
Type Description
System.Threading.Tasks.Task<System.Boolean>

ExecuteUpdate(Update)

Declaration
protected virtual bool ExecuteUpdate(Update update)
Parameters
Type Name Description
Update update
Returns
Type Description
System.Boolean

ExecuteUpdateAsync(Update)

Declaration
protected virtual Task<bool> ExecuteUpdateAsync(Update update)
Parameters
Type Name Description
Update update
Returns
Type Description
System.Threading.Tasks.Task<System.Boolean>

ExistInDB(Dictionary<String, Object>)

Checks the existence of an entity the in database by specified conditions collection.

Declaration
public virtual bool ExistInDB(Dictionary<string, object> conditions)
Parameters
Type Name Description
System.Collections.Generic.Dictionary<System.String, System.Object> conditions

Key-value collection containing conditions for entity query filtration.

Returns
Type Description
System.Boolean

true if entity exists. Otherwise returns false.

Exceptions
Type Condition
System.ArgumentNullException

conditions

ExistInDB(Object)

Declaration
public bool ExistInDB(object keyValue)
Parameters
Type Name Description
System.Object keyValue
Returns
Type Description
System.Boolean

ExistInDB(String, Object)

Declaration
public bool ExistInDB(string conditionColumnName, object conditionValue)
Parameters
Type Name Description
System.String conditionColumnName
System.Object conditionValue
Returns
Type Description
System.Boolean

ExistInDB(EntitySchemaColumn, Object)

Checks the existence of an entity the in database by specified condition column and condition value for entity query filtration.

Declaration
public bool ExistInDB(EntitySchemaColumn conditionColumn, object conditionValue)
Parameters
Type Name Description
EntitySchemaColumn conditionColumn

Query condition column name.

System.Object conditionValue

Query condition column value.

Returns
Type Description
System.Boolean

true if entity exists. Otherwise returns false.

Exceptions
Type Condition
System.ArgumentNullException

conditions

FetchFromDB(Dictionary<String, Object>, Boolean)

Fetches entity from database by specified conditions collection.

Declaration
public virtual bool FetchFromDB(Dictionary<string, object> conditions, bool useDisplayValues = true)
Parameters
Type Name Description
System.Collections.Generic.Dictionary<System.String, System.Object> conditions

Key-value collection containing conditions for entity query filtration.

System.Boolean useDisplayValues

Indicate whether to get primary display values. If true primaty display values will be fetched.

Returns
Type Description
System.Boolean

true if entity loaded. Otherwise returns false.

FetchFromDB(IEnumerable<String>, Boolean)

Loads values for specified columns from database.

Declaration
public bool FetchFromDB(IEnumerable<string> columnNamesToFetch, bool useDisplayValues)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<System.String> columnNamesToFetch

Column names to load.

System.Boolean useDisplayValues

Indicate whether to get primary display values. If true primaty display values will be fetched.

Returns
Type Description
System.Boolean

true if column values loaded. Otherwise returns false.

FetchFromDB(Object, Boolean)

Loads the object from the database by the specified value of the key field.

Declaration
public bool FetchFromDB(object keyValue, bool useDisplayValues = true)
Parameters
Type Name Description
System.Object keyValue

Key field value.

System.Boolean useDisplayValues

Indicates that the query returns the primary display values. If the parameter is true, the query will return the primary display values.

Returns
Type Description
System.Boolean

true,, if the object is loaded otherwise - false.

FetchFromDB(String, Object, Boolean)

By the specified condition, loads the object from the database.

Declaration
public bool FetchFromDB(string conditionColumnName, object conditionValue, bool useDisplayValues = true)
Parameters
Type Name Description
System.String conditionColumnName

The name of the column for which the selection condition is specified.

System.Object conditionValue

The value of the condition column for the selected data.

System.Boolean useDisplayValues

Indicates that the query returns the primary display values. If the parameter is true, the query will return the primary display values.

Returns
Type Description
System.Boolean

true,, if the object is loaded otherwise - false.

FetchFromDB(String, Object, IEnumerable<String>, Boolean)

Under the specified condition, loads an object from the database with a set of columns with the specified names.

Declaration
public virtual bool FetchFromDB(string conditionColumnName, object conditionValue, IEnumerable<string> columnNamesToFetch, bool useDisplayValues = true)
Parameters
Type Name Description
System.String conditionColumnName

The name of the column for which the selection condition is specified.

System.Object conditionValue

The value of the condition column for the selected data.

System.Collections.Generic.IEnumerable<System.String> columnNamesToFetch

List of column names to be selected.

System.Boolean useDisplayValues

Indicates that the query returns the primary display values. If the parameter is true, the query will return the primary display values.

Returns
Type Description
System.Boolean

true,, if the object is loaded otherwise - false.

FetchFromDB(EntitySchemaColumn, Object, Boolean)

Fetches entity from database by specified condition column value.

Declaration
public virtual bool FetchFromDB(EntitySchemaColumn conditionColumn, object conditionValue, bool useDisplayValues = true)
Parameters
Type Name Description
EntitySchemaColumn conditionColumn

Query condition column name.

System.Object conditionValue

Query condition column value.

System.Boolean useDisplayValues

Indicate whether to get primary display values. If true primary display values will be fetched.

Returns
Type Description
System.Boolean

true if entity loaded. Otherwise returns false.

FetchFromDB(EntitySchemaColumn, Object, IEnumerable<EntitySchemaColumn>, Boolean)

Fetches entity from database by specified condition column, condition value and columns to fetch.

Declaration
public bool FetchFromDB(EntitySchemaColumn conditionColumn, object conditionValue, IEnumerable<EntitySchemaColumn> columnsToFetch, bool useDisplayValues = true)
Parameters
Type Name Description
EntitySchemaColumn conditionColumn

Query condition column name.

System.Object conditionValue

Query condition column value.

System.Collections.Generic.IEnumerable<EntitySchemaColumn> columnsToFetch

Collection of columns to fetch.

System.Boolean useDisplayValues

Indicate whether to get primary display values. If true primaty display values will be fetched.

Returns
Type Description
System.Boolean

true if entity loaded. Otherwise returns false.

FetchPrimaryColumnFromDB(Object)

Declaration
public bool FetchPrimaryColumnFromDB(object keyValue)
Parameters
Type Name Description
System.Object keyValue
Returns
Type Description
System.Boolean

FetchPrimaryInfoFromDB(String, Object)

Declaration
public bool FetchPrimaryInfoFromDB(string conditionColumnName, object conditionValue)
Parameters
Type Name Description
System.String conditionColumnName
System.Object conditionValue
Returns
Type Description
System.Boolean

FetchPrimaryInfoFromDB(EntitySchemaColumn, Object)

Declaration
public bool FetchPrimaryInfoFromDB(EntitySchemaColumn conditionColumn, object conditionValue)
Parameters
Type Name Description
EntitySchemaColumn conditionColumn
System.Object conditionValue
Returns
Type Description
System.Boolean

FindEntityColumnValue(String)

Declaration
public EntityColumnValue FindEntityColumnValue(string columnValueName)
Parameters
Type Name Description
System.String columnValueName
Returns
Type Description
EntityColumnValue

ForceGetEntityColumnValue(String)

Declaration
public EntityColumnValue ForceGetEntityColumnValue(string columnValueName)
Parameters
Type Name Description
System.String columnValueName
Returns
Type Description
EntityColumnValue

ForceSetColumnValue(String, Object)

Declaration
public bool ForceSetColumnValue(string valueName, object value)
Parameters
Type Name Description
System.String valueName
System.Object value
Returns
Type Description
System.Boolean

GetBytesValue(String)

Gets the value of the specified column as a byte array.

Declaration
public virtual byte[] GetBytesValue(string valueName)
Parameters
Type Name Description
System.String valueName

Name of the object column.

Returns
Type Description
System.Byte[]

The value of the column with the valueName name of the System.Byte type.

GetChangedColumnValues()

Returns column values that are changed.

Declaration
public IEnumerable<EntityColumnValue> GetChangedColumnValues()
Returns
Type Description
System.Collections.Generic.IEnumerable<EntityColumnValue>

List of column values.

GetColumnDisplayValue(EntitySchemaColumn)

Declaration
public string GetColumnDisplayValue(EntitySchemaColumn column)
Parameters
Type Name Description
EntitySchemaColumn column
Returns
Type Description
System.String

GetColumnNames()

Declaration
public IReadOnlyCollection<string> GetColumnNames()
Returns
Type Description
System.Collections.Generic.IReadOnlyCollection<System.String>

GetColumnOldValue(String)

Declaration
public object GetColumnOldValue(string valueName)
Parameters
Type Name Description
System.String valueName
Returns
Type Description
System.Object

GetColumnOldValue(EntitySchemaColumn)

Declaration
public object GetColumnOldValue(EntitySchemaColumn column)
Parameters
Type Name Description
EntitySchemaColumn column
Returns
Type Description
System.Object

GetColumnValue(String)

Declaration
public virtual object GetColumnValue(string valueName)
Parameters
Type Name Description
System.String valueName
Returns
Type Description
System.Object

GetColumnValue(EntitySchemaColumn)

Declaration
public virtual object GetColumnValue(EntitySchemaColumn column)
Parameters
Type Name Description
EntitySchemaColumn column
Returns
Type Description
System.Object

GetColumnValueNames()

Declaration
public IEnumerable<string> GetColumnValueNames()
Returns
Type Description
System.Collections.Generic.IEnumerable<System.String>

GetColumnValues()

Declaration
public IReadOnlyDictionary<string, object> GetColumnValues()
Returns
Type Description
System.Collections.Generic.IReadOnlyDictionary<System.String, System.Object>

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32
Overrides
System.Object.GetHashCode()

GetIsColumnValueLoaded(String)

Declaration
public virtual bool GetIsColumnValueLoaded(string valueName)
Parameters
Type Name Description
System.String valueName
Returns
Type Description
System.Boolean

GetIsColumnValueLoaded(EntitySchemaColumn)

Declaration
public bool GetIsColumnValueLoaded(EntitySchemaColumn column)
Parameters
Type Name Description
EntitySchemaColumn column
Returns
Type Description
System.Boolean

GetLocalizationEntity(Guid)

Declaration
protected virtual Entity GetLocalizationEntity(Guid cultureId)
Parameters
Type Name Description
System.Guid cultureId
Returns
Type Description
Entity

GetStreamValue(String)

Declaration
public virtual MemoryStream GetStreamValue(string valueName)
Parameters
Type Name Description
System.String valueName
Returns
Type Description
System.IO.MemoryStream

GetSysCultures()

Declaration
protected virtual Dictionary<Guid, string> GetSysCultures()
Returns
Type Description
System.Collections.Generic.Dictionary<System.Guid, System.String>

GetTypedColumnValue<TResult>(String)

Declaration
public virtual TResult GetTypedColumnValue<TResult>(string valueName)
Parameters
Type Name Description
System.String valueName
Returns
Type Description
TResult
Type Parameters
Name Description
TResult

GetTypedColumnValue<TResult>(EntitySchemaColumn)

Declaration
public TResult GetTypedColumnValue<TResult>(EntitySchemaColumn column)
Parameters
Type Name Description
EntitySchemaColumn column
Returns
Type Description
TResult
Type Parameters
Name Description
TResult

GetTypedOldColumnValue<TResult>(String)

Declaration
public TResult GetTypedOldColumnValue<TResult>(string valueName)
Parameters
Type Name Description
System.String valueName
Returns
Type Description
TResult
Type Parameters
Name Description
TResult

GetTypedOldColumnValue<TResult>(EntitySchemaColumn)

Declaration
public TResult GetTypedOldColumnValue<TResult>(EntitySchemaColumn column)
Parameters
Type Name Description
EntitySchemaColumn column
Returns
Type Description
TResult
Type Parameters
Name Description
TResult

InitializeEmbeddedProcess()

Declaration
protected virtual Process InitializeEmbeddedProcess()
Returns
Type Description
Process

InitializeThrowEvents()

Declaration
protected virtual void InitializeThrowEvents()

InsertToDB(Boolean, Boolean)

Inserts the entity to DB.

Declaration
public virtual bool InsertToDB(bool skipLookupColumnValues = false, bool validateRequired = true)
Parameters
Type Name Description
System.Boolean skipLookupColumnValues

Flag that indicates whether skip lookup column values while inserting.

System.Boolean validateRequired

Flag that indicates whether validate required column values while inserting.

Returns
Type Description
System.Boolean

Boolean value that indicates successfully inserted entity.

InsertToDB(Boolean, Boolean, Boolean)

Inserts the entity to DB.

Declaration
public virtual bool InsertToDB(bool skipLookupColumnValues, bool validateRequired, bool trackChanges)
Parameters
Type Name Description
System.Boolean skipLookupColumnValues

Flag that indicates whether skip lookup column values while inserting.

System.Boolean validateRequired

Flag that indicates whether validate required column values while inserting.

System.Boolean trackChanges

Indicates whether to track changes.

Returns
Type Description
System.Boolean

Boolean value that indicates successfully inserted entity.

IsColumnValueLoaded(String)

Declaration
public bool IsColumnValueLoaded(string valueName)
Parameters
Type Name Description
System.String valueName
Returns
Type Description
System.Boolean

IsColumnValueLoaded(EntitySchemaColumn)

Declaration
public bool IsColumnValueLoaded(EntitySchemaColumn column)
Parameters
Type Name Description
EntitySchemaColumn column
Returns
Type Description
System.Boolean

Load(DataRow)

Declaration
public virtual bool Load(DataRow dataRow)
Parameters
Type Name Description
System.Data.DataRow dataRow
Returns
Type Description
System.Boolean

Load(DataRow, Dictionary<String, String>)

Declaration
public virtual bool Load(DataRow dataRow, Dictionary<string, string> columnMap)
Parameters
Type Name Description
System.Data.DataRow dataRow
System.Collections.Generic.Dictionary<System.String, System.String> columnMap
Returns
Type Description
System.Boolean

Load(IDataReader)

Declaration
public virtual bool Load(IDataReader dataReader)
Parameters
Type Name Description
System.Data.IDataReader dataReader
Returns
Type Description
System.Boolean

Load(IDataReader, IDictionary<String, String>)

Declaration
public virtual bool Load(IDataReader dataReader, IDictionary<string, string> columnMap)
Parameters
Type Name Description
System.Data.IDataReader dataReader
System.Collections.Generic.IDictionary<System.String, System.String> columnMap
Returns
Type Description
System.Boolean

Load(Object)

Declaration
public virtual bool Load(object dataSource)
Parameters
Type Name Description
System.Object dataSource
Returns
Type Description
System.Boolean

Load(Object, IDictionary<String, String>)

Declaration
public virtual bool Load(object dataSource, IDictionary<string, string> columnMap)
Parameters
Type Name Description
System.Object dataSource
System.Collections.Generic.IDictionary<System.String, System.String> columnMap
Returns
Type Description
System.Boolean

Load(Select, IDictionary<String, String>)

Declaration
protected virtual bool Load(Select select, IDictionary<string, string> columnMap)
Parameters
Type Name Description
Select select
System.Collections.Generic.IDictionary<System.String, System.String> columnMap
Returns
Type Description
System.Boolean

LoadColumnValue(String, IDataReader, Int32)

Declaration
public void LoadColumnValue(string columnValueName, IDataReader dataReader, int fieldIndex)
Parameters
Type Name Description
System.String columnValueName
System.Data.IDataReader dataReader
System.Int32 fieldIndex

LoadColumnValue(String, IDataReader, Int32, Int32)

Declaration
public void LoadColumnValue(string columnValueName, IDataReader dataReader, int fieldIndex, int binaryPackageSize)
Parameters
Type Name Description
System.String columnValueName
System.Data.IDataReader dataReader
System.Int32 fieldIndex
System.Int32 binaryPackageSize

LoadColumnValue(String, Object)

Declaration
public void LoadColumnValue(string columnValueName, object value)
Parameters
Type Name Description
System.String columnValueName
System.Object value

LoadColumnValue(EntitySchemaColumn, Object)

Declaration
public void LoadColumnValue(EntitySchemaColumn column, object value)
Parameters
Type Name Description
EntitySchemaColumn column
System.Object value

LoadLookupDisplayValues()

Declaration
public void LoadLookupDisplayValues()

LoadLookupDisplayValues(IEnumerable<String>)

Declaration
public void LoadLookupDisplayValues(IEnumerable<string> columnNames)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<System.String> columnNames

LoadLookupDisplayValues(IEnumerable<EntitySchemaColumn>)

Declaration
public void LoadLookupDisplayValues(IEnumerable<EntitySchemaColumn> columns)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<EntitySchemaColumn> columns

LoadLookupDisplayValues(String[])

Declaration
public void LoadLookupDisplayValues(params string[] columnNames)
Parameters
Type Name Description
System.String[] columnNames

LoadLookupDisplayValues(Select)

Declaration
protected void LoadLookupDisplayValues(Select select)
Parameters
Type Name Description
Select select

LoadShallow(DataRow)

Declaration
public virtual bool LoadShallow(DataRow dataRow)
Parameters
Type Name Description
System.Data.DataRow dataRow
Returns
Type Description
System.Boolean

LoadShallow(DataRow, Dictionary<String, String>)

Declaration
public virtual bool LoadShallow(DataRow dataRow, Dictionary<string, string> columnMap)
Parameters
Type Name Description
System.Data.DataRow dataRow
System.Collections.Generic.Dictionary<System.String, System.String> columnMap
Returns
Type Description
System.Boolean

LoadShallow(IDataReader)

Declaration
public virtual bool LoadShallow(IDataReader dataReader)
Parameters
Type Name Description
System.Data.IDataReader dataReader
Returns
Type Description
System.Boolean

LoadShallow(IDataReader, Dictionary<String, String>)

Declaration
public virtual bool LoadShallow(IDataReader dataReader, Dictionary<string, string> columnMap)
Parameters
Type Name Description
System.Data.IDataReader dataReader
System.Collections.Generic.Dictionary<System.String, System.String> columnMap
Returns
Type Description
System.Boolean

LoadShallow(Object)

Declaration
public virtual bool LoadShallow(object dataSource)
Parameters
Type Name Description
System.Object dataSource
Returns
Type Description
System.Boolean

LoadShallow(Object, Dictionary<String, String>)

Declaration
public virtual bool LoadShallow(object dataSource, Dictionary<string, string> columnMap)
Parameters
Type Name Description
System.Object dataSource
System.Collections.Generic.Dictionary<System.String, System.String> columnMap
Returns
Type Description
System.Boolean

LoadShallowColumnValue(String, Object)

Declaration
public void LoadShallowColumnValue(string columnValueName, object value)
Parameters
Type Name Description
System.String columnValueName
System.Object value

LoadShallowColumnValue(EntitySchemaColumn, Object)

Declaration
public void LoadShallowColumnValue(EntitySchemaColumn column, object value)
Parameters
Type Name Description
EntitySchemaColumn column
System.Object value

OnColumnValueChanged(EntityColumnAfterEventArgs)

Declaration
protected virtual void OnColumnValueChanged(EntityColumnAfterEventArgs e)
Parameters
Type Name Description
EntityColumnAfterEventArgs e

OnColumnValueChanging(EntityColumnBeforeEventArgs)

Declaration
protected virtual void OnColumnValueChanging(EntityColumnBeforeEventArgs e)
Parameters
Type Name Description
EntityColumnBeforeEventArgs e

OnDefColumnValuesSet(EventArgs)

Declaration
protected virtual void OnDefColumnValuesSet(EventArgs e)
Parameters
Type Name Description
System.EventArgs e

OnDeleted(EntityAfterEventArgs)

Declaration
protected virtual void OnDeleted(EntityAfterEventArgs e)
Parameters
Type Name Description
EntityAfterEventArgs e

OnDeleted(EntityAfterEventArgs, Boolean)

Declaration
protected virtual void OnDeleted(EntityAfterEventArgs e, bool trackChanges)
Parameters
Type Name Description
EntityAfterEventArgs e
System.Boolean trackChanges

OnDeleteFailed(EntityErrorEventArgs)

Declaration
protected virtual void OnDeleteFailed(EntityErrorEventArgs e)
Parameters
Type Name Description
EntityErrorEventArgs e

OnDeleting(EntityBeforeEventArgs)

Declaration
protected virtual void OnDeleting(EntityBeforeEventArgs e)
Parameters
Type Name Description
EntityBeforeEventArgs e

OnInserted(EntityAfterEventArgs)

Declaration
protected virtual void OnInserted(EntityAfterEventArgs e)
Parameters
Type Name Description
EntityAfterEventArgs e

OnInserted(EntityAfterEventArgs, Boolean)

Declaration
protected virtual void OnInserted(EntityAfterEventArgs e, bool trackChanges)
Parameters
Type Name Description
EntityAfterEventArgs e
System.Boolean trackChanges

OnInserting(EntityBeforeEventArgs)

Declaration
protected virtual void OnInserting(EntityBeforeEventArgs e)
Parameters
Type Name Description
EntityBeforeEventArgs e

OnLoaded(EntityAfterLoadEventArgs)

Declaration
protected virtual void OnLoaded(EntityAfterLoadEventArgs e)
Parameters
Type Name Description
EntityAfterLoadEventArgs e

OnLoading(EntityBeforeLoadEventArgs)

Declaration
protected virtual void OnLoading(EntityBeforeLoadEventArgs e)
Parameters
Type Name Description
EntityBeforeLoadEventArgs e

OnSaved(EntityAfterEventArgs)

Declaration
protected virtual void OnSaved(EntityAfterEventArgs e)
Parameters
Type Name Description
EntityAfterEventArgs e

OnSaveError(EntitySaveErrorEventArgs)

Declaration
protected virtual void OnSaveError(EntitySaveErrorEventArgs e)
Parameters
Type Name Description
EntitySaveErrorEventArgs e

OnSaving(EntityBeforeEventArgs)

Declaration
protected virtual void OnSaving(EntityBeforeEventArgs e)
Parameters
Type Name Description
EntityBeforeEventArgs e

OnUpdated(EntityAfterEventArgs)

Declaration
protected virtual void OnUpdated(EntityAfterEventArgs e)
Parameters
Type Name Description
EntityAfterEventArgs e

OnUpdated(EntityAfterEventArgs, Boolean)

Declaration
protected virtual void OnUpdated(EntityAfterEventArgs e, bool trackChanges)
Parameters
Type Name Description
EntityAfterEventArgs e
System.Boolean trackChanges

OnUpdating(EntityBeforeEventArgs)

Declaration
protected virtual void OnUpdating(EntityBeforeEventArgs e)
Parameters
Type Name Description
EntityBeforeEventArgs e

OnValidating(EntityValidationEventArgs)

Declaration
protected virtual void OnValidating(EntityValidationEventArgs e)
Parameters
Type Name Description
EntityValidationEventArgs e

Read(UserConnection, DataReader)

Returns the value of the current property of the Entity type from the output stream.

Declaration
public static Entity Read(UserConnection userConnection, DataReader dataReader)
Parameters
Type Name Description
UserConnection userConnection

User connection.

DataReader dataReader

The instance of the Terrasoft.Core.DataReader class.

Returns
Type Description
Entity

The instance of the Entity class.

ReadData(DataReader)

Declaration
public void ReadData(DataReader reader)
Parameters
Type Name Description
DataReader reader

ReadData(DataReader, EntitySchema)

Reads entity data with the specified data reader.

Declaration
public void ReadData(DataReader reader, EntitySchema schema)
Parameters
Type Name Description
DataReader reader

The data reader.

EntitySchema schema

Entity schema.

ResetColumnValues()

Declaration
public void ResetColumnValues()

ResetOldColumnValues()

Declaration
public void ResetOldColumnValues()

Save(Boolean, Boolean)

Saves the entity in DB.

Declaration
public bool Save(bool validateRequired = true, bool setColumnDefValue = true)
Parameters
Type Name Description
System.Boolean validateRequired

Flag that indicates whether validate required column values while saving.

System.Boolean setColumnDefValue

Flag that indicates whether set lookup column default values while saving.

Returns
Type Description
System.Boolean

Boolean value that indicates successfully saved entity.

Save(Boolean, Boolean, Boolean)

Saves the entity in DB.

Declaration
public bool Save(bool validateRequired, bool setColumnDefValue, bool trackChanges)
Parameters
Type Name Description
System.Boolean validateRequired

Flag that indicates whether validate required column values while saving.

System.Boolean setColumnDefValue

Flag that indicates whether set lookup column default values while saving.

System.Boolean trackChanges

Indicates whether to track changes.

Returns
Type Description
System.Boolean

Boolean value that indicates successfully saved entity.

Save(EntitySaveConfig)

Declaration
public virtual bool Save(EntitySaveConfig saveConfig)
Parameters
Type Name Description
EntitySaveConfig saveConfig
Returns
Type Description
System.Boolean

SerializeToJson(Entity)

Declaration
public static string SerializeToJson(Entity entity)
Parameters
Type Name Description
Entity entity
Returns
Type Description
System.String

SetBytesValue(String, Byte[])

Sets passed value of the System.Byte type for the specified property of an object.

Declaration
public virtual void SetBytesValue(string valueName, byte[] streamBytes)
Parameters
Type Name Description
System.String valueName

The name of the property of an object.

System.Byte[] streamBytes

Value of the System.Byte type that is set for the property.

SetBytesValue(EntityColumnValue, Byte[])

Declaration
protected bool SetBytesValue(EntityColumnValue columnValue, byte[] value)
Parameters
Type Name Description
EntityColumnValue columnValue
System.Byte[] value
Returns
Type Description
System.Boolean

SetColumnBothValues(String, Object, String, String)

Declaration
public bool SetColumnBothValues(string columnValueName, object value, string displayColumnValueName, string displayValue)
Parameters
Type Name Description
System.String columnValueName
System.Object value
System.String displayColumnValueName
System.String displayValue
Returns
Type Description
System.Boolean

SetColumnBothValues(EntityColumnValue, Object, EntityColumnValue, String)

Declaration
protected bool SetColumnBothValues(EntityColumnValue columnValue, object value, EntityColumnValue displayColumnValue, string displayValue)
Parameters
Type Name Description
EntityColumnValue columnValue
System.Object value
EntityColumnValue displayColumnValue
System.String displayValue
Returns
Type Description
System.Boolean

SetColumnBothValues(EntitySchemaColumn, Object, String)

Declaration
public bool SetColumnBothValues(EntitySchemaColumn column, object value, string displayValue)
Parameters
Type Name Description
EntitySchemaColumn column
System.Object value
System.String displayValue
Returns
Type Description
System.Boolean

SetColumnDefValue()

Declaration
protected virtual void SetColumnDefValue()

SetColumnValue(String, Object)

Sets specified column value.

Declaration
public virtual bool SetColumnValue(string valueName, object value)
Parameters
Type Name Description
System.String valueName

Name of the object column.

System.Object value

Column value.

Returns
Type Description
System.Boolean

true, if value was changed; otherwise false.

SetColumnValue(EntityColumnValue, Object)

Declaration
protected bool SetColumnValue(EntityColumnValue columnValue, object value)
Parameters
Type Name Description
EntityColumnValue columnValue
System.Object value
Returns
Type Description
System.Boolean

SetColumnValue(EntitySchemaColumn, Object)

Sets specified column value.

Declaration
public virtual bool SetColumnValue(EntitySchemaColumn column, object value)
Parameters
Type Name Description
EntitySchemaColumn column

The column.

System.Object value

The value.

Returns
Type Description
System.Boolean

true, if value was changed; otherwise false.

Exceptions
Type Condition
System.ArgumentNullException

Column is null.

SetDefColumnValue(String)

Declaration
public void SetDefColumnValue(string columnValueName)
Parameters
Type Name Description
System.String columnValueName

SetDefColumnValue(String, Object)

Declaration
public void SetDefColumnValue(string columnValueName, object defValue)
Parameters
Type Name Description
System.String columnValueName
System.Object defValue

SetDefColumnValues()

Declaration
public void SetDefColumnValues()

SetStreamValue(String, Stream)

Declaration
public virtual bool SetStreamValue(string valueName, Stream value)
Parameters
Type Name Description
System.String valueName
System.IO.Stream value
Returns
Type Description
System.Boolean

SetStreamValue(EntityColumnValue, Stream)

Declaration
protected bool SetStreamValue(EntityColumnValue columnValue, Stream value)
Parameters
Type Name Description
EntityColumnValue columnValue
System.IO.Stream value
Returns
Type Description
System.Boolean

ThrowEvent(String, EventArgs)

Declaration
protected object ThrowEvent(string message, EventArgs eventArgs)
Parameters
Type Name Description
System.String message
System.EventArgs eventArgs
Returns
Type Description
System.Object

ToString()

Declaration
public override string ToString()
Returns
Type Description
System.String
Overrides
System.Object.ToString()

TrackChangeInDB(EntitySchema)

Declaration
public virtual bool TrackChangeInDB(EntitySchema changeTrackedSchema)
Parameters
Type Name Description
EntitySchema changeTrackedSchema
Returns
Type Description
System.Boolean

UpdateInDB(Boolean)

Updates the entity in DB.

Declaration
public virtual bool UpdateInDB(bool validateRequired = true)
Parameters
Type Name Description
System.Boolean validateRequired

Flag that indicates whether validate required column values while updateing.

Returns
Type Description
System.Boolean

Boolean value that indicates successfully updated entity.

UpdateInDB(Boolean, Boolean)

Updates the entity in DB.

Declaration
public virtual bool UpdateInDB(bool validateRequired, bool trackChanges)
Parameters
Type Name Description
System.Boolean validateRequired

Flag that indicates whether validate required column values while updateing.

System.Boolean trackChanges

Indicates whether to track changes.

Returns
Type Description
System.Boolean

Boolean value that indicates successfully updated entity.

UpdateRecordRightsPosition(Guid)

Declaration
public void UpdateRecordRightsPosition(Guid primaryColumnValue)
Parameters
Type Name Description
System.Guid primaryColumnValue

Validate()

Declaration
public bool Validate()
Returns
Type Description
System.Boolean

Write(DataWriter, String)

Writes entity data to the specified data writer, regardless it is empty or not.

Declaration
public void Write(DataWriter dataWriter, string propertyName)
Parameters
Type Name Description
DataWriter dataWriter

The data writer.

System.String propertyName

Name of the property.

Write(DataWriter, Entity, String)

Writes the value of the Entity type to the output stream with the given name.

Declaration
public static void Write(DataWriter dataWriter, Entity entity, string propertyName = "Entity")
Parameters
Type Name Description
DataWriter dataWriter

An instance of the DataWriter class that provides methods for sequentially writing values to the output stream.

Entity entity

Value for recording of the Entity type.

System.String propertyName

Object name.

Write(DataWriter, Entity, String, Boolean)

Writes the value of the Entity type to the output stream with the given name.

Declaration
public static void Write(DataWriter dataWriter, Entity entity, string propertyName, bool couldConvertForXml)
Parameters
Type Name Description
DataWriter dataWriter

An instance of the DataWriter class that provides methods for sequentially writing values to the output stream.

Entity entity

Value for recording of the Entity type.

System.String propertyName

Object name.

System.Boolean couldConvertForXml

Allow converting for xml-serialization.

WriteData(DataWriter)

Writes to the output stream for the current object schema.

Declaration
public void WriteData(DataWriter writer)
Parameters
Type Name Description
DataWriter writer

An instance of the DataWriter class that provides methods for sequentially writing values to the output stream.

WriteData(DataWriter, EntitySchema)

Writes to the output stream for the specified object schema.

Declaration
public void WriteData(DataWriter writer, EntitySchema schema)
Parameters
Type Name Description
DataWriter writer

An instance of the DataWriter class that provides methods for sequentially writing values to the output stream.

EntitySchema schema

Object schema.

WriteData(DataWriter, EntitySchema, Boolean)

Writes to the output stream for the specified object schema.

Declaration
public void WriteData(DataWriter writer, EntitySchema schema, bool couldConvertForXml)
Parameters
Type Name Description
DataWriter writer

An instance of the DataWriter class that provides methods for sequentially writing values to the output stream.

EntitySchema schema

Object schema.

System.Boolean couldConvertForXml

Allows converting for xml-serialization.

Events

ColumnValueChanged

Declaration
public event EventHandler<EntityColumnAfterEventArgs> ColumnValueChanged
Event Type
Type Description
System.EventHandler<EntityColumnAfterEventArgs>

ColumnValueChanging

Declaration
public event EventHandler<EntityColumnBeforeEventArgs> ColumnValueChanging
Event Type
Type Description
System.EventHandler<EntityColumnBeforeEventArgs>

DefColumnValuesSet

Declaration
public event EventHandler<EventArgs> DefColumnValuesSet
Event Type
Type Description
System.EventHandler<System.EventArgs>

Deleted

Declaration
public event EventHandler<EntityAfterEventArgs> Deleted
Event Type
Type Description
System.EventHandler<EntityAfterEventArgs>

Deleting

Declaration
public event EventHandler<EntityBeforeEventArgs> Deleting
Event Type
Type Description
System.EventHandler<EntityBeforeEventArgs>

Inserted

Declaration
public event EventHandler<EntityAfterEventArgs> Inserted
Event Type
Type Description
System.EventHandler<EntityAfterEventArgs>

Inserting

Declaration
public event EventHandler<EntityBeforeEventArgs> Inserting
Event Type
Type Description
System.EventHandler<EntityBeforeEventArgs>

Loaded

Declaration
public event EventHandler<EntityAfterLoadEventArgs> Loaded
Event Type
Type Description
System.EventHandler<EntityAfterLoadEventArgs>

Loading

Declaration
public event EventHandler<EntityBeforeLoadEventArgs> Loading
Event Type
Type Description
System.EventHandler<EntityBeforeLoadEventArgs>

Saved

Declaration
public event EventHandler<EntityAfterEventArgs> Saved
Event Type
Type Description
System.EventHandler<EntityAfterEventArgs>

SaveError

Declaration
public event EventHandler<EntitySaveErrorEventArgs> SaveError
Event Type
Type Description
System.EventHandler<EntitySaveErrorEventArgs>

Saving

Declaration
public event EventHandler<EntityBeforeEventArgs> Saving
Event Type
Type Description
System.EventHandler<EntityBeforeEventArgs>

Updated

Declaration
public event EventHandler<EntityAfterEventArgs> Updated
Event Type
Type Description
System.EventHandler<EntityAfterEventArgs>

Updating

Declaration
public event EventHandler<EntityBeforeEventArgs> Updating
Event Type
Type Description
System.EventHandler<EntityBeforeEventArgs>

Validating

Declaration
public event EventHandler<EntityValidationEventArgs> Validating
Event Type
Type Description
System.EventHandler<EntityValidationEventArgs>

Explicit Interface Implementations

ICompositeObject.TryGetValue(String, Type, out Object)

Returns inner value by key.

Declaration
bool ICompositeObject.TryGetValue(string key, Type type, out object value)
Parameters
Type Name Description
System.String key

The key.

System.Type type
System.Object value

Result value.

Returns
Type Description
System.Boolean

ICompositeObject.TryGetValue<TValueType>(String, out TValueType)

Declaration
bool ICompositeObject.TryGetValue<T>(string key, out T value)
Parameters
Type Name Description
System.String key
T value
Returns
Type Description
System.Boolean
Type Parameters
Name Description
T

Implements

IEntity
System.ICloneable
ILicObject
ICompositeObject

Extension Methods

ReflectionUtilities.GetPropertyValue(Object, String)
ReflectionUtilities.GetPropertyDefValue(Object, String, Object)
ReflectionUtilities.TryGetPropertyValue(Object, String, out Object)
ReflectionUtilities.HasProperty(Object, String)
ReflectionUtilities.GetPropertyValue(Object, String, BindingFlags)
ReflectionUtilities.GetPropertyValueByPath(Object, String)
ReflectionUtilities.SetPropertyValue(Object, String, Object)
ReflectionUtilities.TrySetPropertyValue(Object, String, Object)
ValidateUtilities.CheckArgumentNull(Object, String)
ValidateUtilities.CheckDependencyNull(Object, String)
ValidateUtilities.EnsureDependencyNotNull<T>(T, String)
EntityExtensions.CopyEntityLookupProperties(Entity, Entity)
CoreEntityExtension.FillColumnValues(Entity, UserConnection, ColumnValues)
LookupResolver.SetLookupColumnValue(Entity, String, String, String)
MetaDataTestUtils.MetaPropertiesShouldNotHaveDefValue<TInstance>(TInstance)
MetaDataTestUtils.MetaPropertiesShouldNotHaveDefValue<TInstance>(TInstance, Boolean)
NSubstituteExtension.Protected(Object, String, Object[])
NSubstituteExtension.Protected(Object, String, Boolean, Object[])
NSubstituteExtension.ProtectedGeneric<T>(Object, String, Object[])
NSubstituteExtension.ProtectedGeneric<T>(Object, String, Boolean, Object[])
NSubstituteExtension.ProtectedProperty(Object, String)
NSubstituteExtension.MatchInstance<T>(T)
SubstituteUtilities.GetIsSubstituteObject(Object)
SubstituteUtilities.Instead<TInstance, TValue>(TInstance, Func<TInstance, TValue>)
Back to top Generated by DocFX