Show / Hide Table of Contents

Class Row

Base class for any CRUD row. This class has two direct subtypes - DynamicRow and TypedRow. Rows are NOT THREAD SAFE by definition

Inheritance
System.Object
Row
DynamicRow
TypedRow
Implements
IConfigurable
IConfigurationPersistent
System.IEquatable<Row>
System.Collections.Generic.IEnumerable<System.Object>
System.Collections.IEnumerable
IValidatable
IJSONWritable
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: NFX.DataAccess.CRUD
Assembly: NFX.dll
Syntax
[Serializable]
public abstract class Row : IConfigurable, IConfigurationPersistent, IEquatable<Row>, IEnumerable<object>, IEnumerable, IValidatable, IJSONWritable

Properties

Item[Int32]

Gets/sets field values by positional index(Order)

Declaration
public object this[int fieldIdx] { get; set; }
Parameters
Type Name Description
System.Int32 fieldIdx
Property Value
Type Description
System.Object

Item[String]

Gets/sets field values by name

Declaration
public object this[string fieldName] { get; set; }
Parameters
Type Name Description
System.String fieldName
Property Value
Type Description
System.Object

Schema

References a schema for a table that this row is part of

Declaration
public abstract Schema Schema { get; }
Property Value
Type Description
Schema

Methods

ApplyDefaultFieldValues(String, Boolean)

Writes default values specified in schema into fields. Pass overwrite=true to force defaults over non-null existing values (false by default)

Declaration
public void ApplyDefaultFieldValues(string targetName = null, bool overwrite = false)
Parameters
Type Name Description
System.String targetName
System.Boolean overwrite

CheckMinMax(FieldAttribute, String, IComparable)

Declaration
protected Exception CheckMinMax(FieldAttribute atr, string fName, IComparable val)
Parameters
Type Name Description
FieldAttribute atr
System.String fName
System.IComparable val
Returns
Type Description
System.Exception

Configure(IConfigSectionNode)

In base class applies Config attribute. Useful for typed rows

Declaration
public virtual void Configure(IConfigSectionNode node)
Parameters
Type Name Description
IConfigSectionNode node

ConvertFieldValueToDef(Schema.FieldDef, Object)

Converts field value to the type specified by Schema.FieldDef. For example converts GDID->ulong or ulong->GDID. This method can be overridden to perform custom handling of types, for example one can assign bool field as "Si" that would convert to TRUE. This method is called by SetFieldValue(...) before assigning actual field buffer

Declaration
public virtual object ConvertFieldValueToDef(Schema.FieldDef fdef, object value)
Parameters
Type Name Description
Schema.FieldDef fdef

Field being converted

System.Object value

Value to convert

Returns
Type Description
System.Object

Converted value before assignment to field buffer

CopyFields(Row, Boolean, Boolean, Func<String, Schema.FieldDef, Boolean>, Func<String, String, Boolean>)

Copies fields from this row into another row/form. Note: this is shallow copy, as field values for complex types are just copied over

Declaration
public void CopyFields(Row other, bool includeAmorphousData = true, bool invokeAmorphousAfterLoad = true, Func<string, Schema.FieldDef, bool> fieldFilter = null, Func<string, string, bool> amorphousFieldFilter = null)
Parameters
Type Name Description
Row other
System.Boolean includeAmorphousData
System.Boolean invokeAmorphousAfterLoad
System.Func<System.String, Schema.FieldDef, System.Boolean> fieldFilter
System.Func<System.String, System.String, System.Boolean> amorphousFieldFilter

Equals(Row)

Override to perform custom row equality comparison. Default implementation equates rows using their key fields

Declaration
public virtual bool Equals(Row other)
Parameters
Type Name Description
Row other
Returns
Type Description
System.Boolean

Equals(Object)

Object override - sealed. Override Equals(row) instead

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

FilterJSONSerializerField(Schema.FieldDef, JSONWritingOptions, out String)

Override to filter-out some fields from serialization to JSON, or change field values. Return name null to indicate that field should be filtered-out(excluded from serialization to JSON)

Declaration
protected virtual object FilterJSONSerializerField(Schema.FieldDef def, JSONWritingOptions options, out string name)
Parameters
Type Name Description
Schema.FieldDef def
JSONWritingOptions options
System.String name
Returns
Type Description
System.Object

GetClientFieldDef(Object, Schema.FieldDef, String, String)

Override to perform dynamic substitute of field def for the specified field. This method is used by client ui/scaffolding to extract dynamic definition for a field (i.e. field description, requirement, value list etc.) as dictated by business logic. This method IS NOT used by row validation, only by client that feeds from row's metadata. The default implementation returns the original field def, you can return a substituted field def per particular business logic

Declaration
public virtual Schema.FieldDef GetClientFieldDef(object callerContext, Schema.FieldDef fdef, string targetName, string isoLang)
Parameters
Type Name Description
System.Object callerContext
Schema.FieldDef fdef
System.String targetName
System.String isoLang
Returns
Type Description
Schema.FieldDef

GetClientFieldValue(Object, Schema.FieldDef, String, String)

Override to perform dynamic substitute of field value for the specified field. This method is used by client ui/scaffolding to extract field values for a field as dictated by business logic. This method IS NOT used by row validation, only by client that feeds from row's metadata. The default implementation returns the original GetFieldValue(fdef), you can return a substituted field value per particular business logic

Declaration
public virtual object GetClientFieldValue(object callerContext, Schema.FieldDef fdef, string targetName, string isoLang)
Parameters
Type Name Description
System.Object callerContext
Schema.FieldDef fdef
System.String targetName
System.String isoLang
Returns
Type Description
System.Object

GetClientFieldValueList(Object, Schema.FieldDef, String, String)

Override to perform dynamic lookup of field value list for the specified field. This method is used by client ui/scaffolding to extract dynamic lookup values as dictated by business logic. This method IS NOT used by row validation, only by client that feeds from row's metadata. This is a simplified version of GetClientFieldDef

Declaration
public virtual JSONDataMap GetClientFieldValueList(object callerContext, Schema.FieldDef fdef, string targetName, string isoLang)
Parameters
Type Name Description
System.Object callerContext
Schema.FieldDef fdef
System.String targetName
System.String isoLang
Returns
Type Description
JSONDataMap

GetDataStoreKey(String)

Returns values for fields that represent row's primary key

Declaration
public IDataStoreKey GetDataStoreKey(string targetName = null)
Parameters
Type Name Description
System.String targetName
Returns
Type Description
IDataStoreKey

GetDisplayFieldValue(Int32, String, Func<Object, Object>)

Returns field value as string formatted per target DisplayFormat attribute

Declaration
public string GetDisplayFieldValue(int fieldIndex, string targetName = null, Func<object, object> transform = null)
Parameters
Type Name Description
System.Int32 fieldIndex
System.String targetName
System.Func<System.Object, System.Object> transform
Returns
Type Description
System.String

GetDisplayFieldValue(String, String, Func<Object, Object>)

Returns field value as string formatted per target DisplayFormat attribute

Declaration
public string GetDisplayFieldValue(string fieldName, string targetName = null, Func<object, object> transform = null)
Parameters
Type Name Description
System.String fieldName
System.String targetName
System.Func<System.Object, System.Object> transform
Returns
Type Description
System.String

GetEnumerator()

Declaration
public IEnumerator<object> GetEnumerator()
Returns
Type Description
System.Collections.Generic.IEnumerator<System.Object>

GetFieldValue(Schema.FieldDef)

Gets value of the field, for typerows it accesses property using reflection; for dynamic rows it reads data from row buffer array using field index(order)

Declaration
public abstract object GetFieldValue(Schema.FieldDef fdef)
Parameters
Type Name Description
Schema.FieldDef fdef
Returns
Type Description
System.Object

GetFieldValueDescription(Int32, String, Boolean)

For fields with ValueList returns value's description per specified targeted schema

Declaration
public string GetFieldValueDescription(int fieldIndex, string targetName = null, bool caseSensitiveKeys = false)
Parameters
Type Name Description
System.Int32 fieldIndex
System.String targetName
System.Boolean caseSensitiveKeys
Returns
Type Description
System.String

GetFieldValueDescription(String, String, Boolean)

For fields with ValueList returns value's description per specified targeted schema

Declaration
public string GetFieldValueDescription(string fieldName, string targetName = null, bool caseSensitiveKeys = false)
Parameters
Type Name Description
System.String fieldName
System.String targetName
System.Boolean caseSensitiveKeys
Returns
Type Description
System.String

GetHashCode()

Object override - gets hash code from key fields

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

MakeRow(Schema, Type)

Factory method that makes an appropriate row type.For performance purposes, this method does not check passed type for Row-derivation and returns null instead if type was invalid

Declaration
public static Row MakeRow(Schema schema, Type tRow = null)
Parameters
Type Name Description
Schema schema

Schema, which is used for creation of DynamicRows and their derivatives

System.Type tRow

A type of row to create, if the type is TypedRow-descending then a parameterless .ctor is called, otherwise a type must have a .ctor that takes schema as a sole argument

Returns
Type Description
Row

Row instance or null if wrong type was passed. For performance purposes, this method does not check passed type for Row-derivation and returns null instead if type was invalid

PersistConfiguration(ConfigSectionNode)

The base class does not implement this method. Override to persist row fields into config node

Declaration
public virtual void PersistConfiguration(ConfigSectionNode node)
Parameters
Type Name Description
ConfigSectionNode node

SetFieldValue(Schema.FieldDef, Object)

Sets value of the field, for typerows it accesses property using reflection; for dynamic rows it sets data into row buffer array using field index(order)

Declaration
public abstract void SetFieldValue(Schema.FieldDef fdef, object value)
Parameters
Type Name Description
Schema.FieldDef fdef
System.Object value

SimpleFilterPredicate(String, Boolean)

Returns true if this row satisfies simple filter - it contains the supplied filter string. The filter pattern may start or end with "*" char that denotes a wildcard. A wildcard is permitted on both sides of the filter value

Declaration
public bool SimpleFilterPredicate(string filter, bool caseSensitive = false)
Parameters
Type Name Description
System.String filter
System.Boolean caseSensitive
Returns
Type Description
System.Boolean

TryFillFromJSON(Row, IJSONDataObject, SetFieldFunc)

Tries to fill the row with data returning true if field count matched

Declaration
public static bool TryFillFromJSON(Row row, IJSONDataObject jsonData, SetFieldFunc setFieldFunc = null)
Parameters
Type Name Description
Row row
IJSONDataObject jsonData
SetFieldFunc setFieldFunc
Returns
Type Description
System.Boolean

Validate()

Performs validation of data in the row returning exception object that provides description in cases when validation does not pass. Validation is performed not targeting any particular backend

Declaration
public virtual Exception Validate()
Returns
Type Description
System.Exception

Validate(String)

Validates row using row schema and supplied field definitions. Override to perform custom validations, i.e. TypeRows may directly access properties and write some validation type-safe code The method is not expected to throw exception in case of failed validation, rather return exception instance because throwing exception really hampers validation performance when many rows need to be validated

Declaration
public virtual Exception Validate(string targetName)
Parameters
Type Name Description
System.String targetName
Returns
Type Description
System.Exception

ValidateField(String, Schema.FieldDef)

Validates row field using Schema.FieldDef settings. This method is invoked by base Validate() implementation. The method is not expected to throw exception in case of failed validation, rather return exception instance because throwing exception really hampers validation performance when many rows need to be validated

Declaration
public virtual Exception ValidateField(string targetName, Schema.FieldDef fdef)
Parameters
Type Name Description
System.String targetName
Schema.FieldDef fdef
Returns
Type Description
System.Exception

ValidateField(String, String)

Validates row field by name. Shortcut to ValidateField(Schema.FieldDef)

Declaration
public Exception ValidateField(string targetName, string fname)
Parameters
Type Name Description
System.String targetName
System.String fname
Returns
Type Description
System.Exception

WriteAsJSON(TextWriter, Int32, JSONWritingOptions)

Writes row as JSON either as an array or map depending on JSONWritingOptions.RowsAsMap setting. Do not call this method directly, instead call rowset.ToJSON() or use JSONWriter class

Declaration
public void WriteAsJSON(TextWriter wri, int nestingLevel, JSONWritingOptions options = null)
Parameters
Type Name Description
System.IO.TextWriter wri
System.Int32 nestingLevel
JSONWritingOptions options

Explicit Interface Implementations

IEnumerable.GetEnumerator()

Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type Description
System.Collections.IEnumerator

Implements

IConfigurable
IConfigurationPersistent
System.IEquatable<T>
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable
IValidatable
IJSONWritable

Extension Methods

CollectionUtils.ForEach<T>(IEnumerable<T>, Action<T>)
CollectionUtils.ForEach<T>(IEnumerable<T>, Action<T, Int32>)
CollectionUtils.SkipLast<T>(IEnumerable<T>)
CollectionUtils.SkipLast<T>(IEnumerable<T>, Int32)
CollectionUtils.FirstMin<TResult, TComparand>(IEnumerable<TResult>, Func<TResult, TComparand>)
CollectionUtils.FirstMin<TResult, TComparand>(IEnumerable<TResult>, Func<TResult, TComparand>, out TComparand)
CollectionUtils.FirstMax<TResult, TComparand>(IEnumerable<TResult>, Func<TResult, TComparand>)
CollectionUtils.FirstMax<TResult, TComparand>(IEnumerable<TResult>, Func<TResult, TComparand>, out TComparand)
CollectionUtils.FirstOrAnyOrDefault<TResult>(IEnumerable<TResult>, Func<TResult, Boolean>)
CollectionUtils.Distinct<TResult, TKey>(IEnumerable<TResult>, Func<TResult, TKey>)
DataUtils.Clone<TRow>(TRow, Boolean, Boolean, Func<String, Schema.FieldDef, Boolean>, Func<String, String, Boolean>)
MiscUtils.NonNull<T>(T, Func<Exception>, String)
ObjectValueConversion.AsString(Object, String, ConvertErrorHandling)
ObjectValueConversion.AsNonNullOrEmptyString(Object)
ObjectValueConversion.AsLaconicConfig(Object, ConfigSectionNode, String, ConvertErrorHandling)
ObjectValueConversion.AsJSONConfig(Object, ConfigSectionNode, String, ConvertErrorHandling)
ObjectValueConversion.AsXMLConfig(Object, ConfigSectionNode, ConvertErrorHandling)
ObjectValueConversion.AsChar(Object, Char, ConvertErrorHandling)
ObjectValueConversion.AsNullableChar(Object, Nullable<Char>, ConvertErrorHandling)
ObjectValueConversion.AsByte(Object, Byte, ConvertErrorHandling)
ObjectValueConversion.AsNullableByte(Object, Nullable<Byte>, ConvertErrorHandling)
ObjectValueConversion.AsSByte(Object, SByte, ConvertErrorHandling)
ObjectValueConversion.AsNullableSByte(Object, Nullable<SByte>, ConvertErrorHandling)
ObjectValueConversion.AsShort(Object, Int16, ConvertErrorHandling)
ObjectValueConversion.AsNullableShort(Object, Nullable<Int16>, ConvertErrorHandling)
ObjectValueConversion.AsUShort(Object, UInt16, ConvertErrorHandling)
ObjectValueConversion.AsNullableUShort(Object, Nullable<UInt16>, ConvertErrorHandling)
ObjectValueConversion.AsInt(Object, Int32, ConvertErrorHandling)
ObjectValueConversion.AsNullableInt(Object, Nullable<Int32>, ConvertErrorHandling)
ObjectValueConversion.AsUInt(Object, UInt32, ConvertErrorHandling)
ObjectValueConversion.AsNullableUInt(Object, Nullable<UInt32>, ConvertErrorHandling)
ObjectValueConversion.AsLong(Object, Int64, ConvertErrorHandling)
ObjectValueConversion.AsNullableLong(Object, Nullable<Int64>, ConvertErrorHandling)
ObjectValueConversion.AsULong(Object, UInt64, ConvertErrorHandling)
ObjectValueConversion.AsNullableULong(Object, Nullable<UInt64>, ConvertErrorHandling)
ObjectValueConversion.AsDouble(Object, Double, ConvertErrorHandling)
ObjectValueConversion.AsNullableDouble(Object, Nullable<Double>, ConvertErrorHandling)
ObjectValueConversion.AsFloat(Object, Single, ConvertErrorHandling)
ObjectValueConversion.AsNullableFloat(Object, Nullable<Single>, ConvertErrorHandling)
ObjectValueConversion.AsDecimal(Object, Decimal, ConvertErrorHandling)
ObjectValueConversion.AsNullableDecimal(Object, Nullable<Decimal>, ConvertErrorHandling)
ObjectValueConversion.AsBool(Object, Boolean, ConvertErrorHandling)
ObjectValueConversion.AsNullableBool(Object, Nullable<Boolean>, ConvertErrorHandling)
ObjectValueConversion.AsGUID(Object, Guid, ConvertErrorHandling)
ObjectValueConversion.AsNullableGUID(Object, Nullable<Guid>, ConvertErrorHandling)
ObjectValueConversion.AsDateTime(Object)
ObjectValueConversion.AsDateTime(Object, DateTime, ConvertErrorHandling)
ObjectValueConversion.AsNullableDateTime(Object, Nullable<DateTime>, ConvertErrorHandling)
ObjectValueConversion.AsGDID(Object)
ObjectValueConversion.AsGDID(Object, GDID, ConvertErrorHandling)
ObjectValueConversion.AsNullableGDID(Object, Nullable<GDID>, ConvertErrorHandling)
ObjectValueConversion.AsGDIDSymbol(Object)
ObjectValueConversion.AsGDIDSymbol(Object, GDIDSymbol, ConvertErrorHandling)
ObjectValueConversion.AsNullableGDIDSymbol(Object, Nullable<GDIDSymbol>, ConvertErrorHandling)
ObjectValueConversion.AsTimeSpan(Object)
ObjectValueConversion.AsTimeSpan(Object, TimeSpan, ConvertErrorHandling)
ObjectValueConversion.AsNullableTimeSpan(Object, Nullable<TimeSpan>, ConvertErrorHandling)
ObjectValueConversion.AsEnum<TEnum>(Object, TEnum, ConvertErrorHandling)
ObjectValueConversion.AsNullableEnum<TEnum>(Object, Nullable<TEnum>, ConvertErrorHandling)
ObjectValueConversion.AsUri(Object, Uri, ConvertErrorHandling)
LookAheadExtensions.AsLookAheadEnumerable<T>(IEnumerable<T>)
JSONExtensions.ToJSON(Object, JSONWritingOptions)
JSONExtensions.ToJSON(Object, TextWriter, JSONWritingOptions)
JSONExtensions.ToJSON(Object, Stream, JSONWritingOptions, Encoding)
ErlObject.ToErlObject(Object)
ErlObject.ToErlObject(Object, ErlTypeOrder, Boolean)
ErlSchemaUtils.ToErlObject(Row, String, String, Boolean)
ErlSchemaUtils.Update(Row, IErlObject, Schema, String, String, Registry<Schema>)
Back to top Copyright © 2006-2018 Agnicore Inc
Generated by DocFX