Show / Hide Table of Contents

Class Schema

Describes a schema for rows: TypedRows and DynamicRows. DynamicRows are "shaped" in memory from schema, whereas, TypedRows define schema. Schema for Typedrows is cached in static dictionary for speed

Inheritance
System.Object
Schema
Implements
INamed
System.Collections.Generic.IEnumerable<Schema.FieldDef>
System.Collections.IEnumerable
IJSONWritable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: NFX.DataAccess.CRUD
Assembly: NFX.dll
Syntax
[Serializable]
public sealed class Schema : INamed, IEnumerable<Schema.FieldDef>, IEnumerable, IJSONWritable

Constructors

Schema(String, Schema.FieldDef[])

Declaration
public Schema(string name, params Schema.FieldDef[] fieldDefs)
Parameters
Type Name Description
System.String name
Schema.FieldDef[] fieldDefs

Schema(String, Boolean, Schema.FieldDef[])

Declaration
public Schema(string name, bool readOnly, params Schema.FieldDef[] fieldDefs)
Parameters
Type Name Description
System.String name
System.Boolean readOnly
Schema.FieldDef[] fieldDefs

Schema(String, Boolean, IEnumerable<Schema.FieldDef>, IEnumerable<TableAttribute>)

Declaration
public Schema(string name, bool readOnly, IEnumerable<Schema.FieldDef> fieldDefs, IEnumerable<TableAttribute> tableAttributes = null)
Parameters
Type Name Description
System.String name
System.Boolean readOnly
System.Collections.Generic.IEnumerable<Schema.FieldDef> fieldDefs
System.Collections.Generic.IEnumerable<TableAttribute> tableAttributes

Schema(String, Boolean, IEnumerable<TableAttribute>, Schema.FieldDef[])

Declaration
public Schema(string name, bool readOnly, IEnumerable<TableAttribute> tableAttributes, params Schema.FieldDef[] fieldDefs)
Parameters
Type Name Description
System.String name
System.Boolean readOnly
System.Collections.Generic.IEnumerable<TableAttribute> tableAttributes
Schema.FieldDef[] fieldDefs

Fields

EXTRA_SUPPORTS_DELETE_ATTR

Declaration
public const string EXTRA_SUPPORTS_DELETE_ATTR = "supports-delete"
Field Value
Type Description
System.String

EXTRA_SUPPORTS_INSERT_ATTR

Declaration
public const string EXTRA_SUPPORTS_INSERT_ATTR = "supports-insert"
Field Value
Type Description
System.String

EXTRA_SUPPORTS_UPDATE_ATTR

Declaration
public const string EXTRA_SUPPORTS_UPDATE_ATTR = "supports-update"
Field Value
Type Description
System.String

Properties

AnyTargetKeyFieldDefs

Returns FieldDefs in their order within rows that are declared as key fields in ANY_TARGET

Declaration
public IEnumerable<Schema.FieldDef> AnyTargetKeyFieldDefs { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<Schema.FieldDef>

AnyVisibleFieldDefs

Returns FieldDefs in their order within rows as

Declaration
public IEnumerable<Schema.FieldDef> AnyVisibleFieldDefs { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<Schema.FieldDef>

ExtraData

Returns Extra data that may be associated with schema by various providers. The field is lazily allocated

Declaration
public JSONDataMap ExtraData { get; }
Property Value
Type Description
JSONDataMap

FieldCount

Returns field count

Declaration
public int FieldCount { get; }
Property Value
Type Description
System.Int32

FieldDefs

Returns FieldDefs in their order within rows that this schema describes

Declaration
public IEnumerable<Schema.FieldDef> FieldDefs { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<Schema.FieldDef>

Item[Int32]

Returns a field definition by a positional index within the row

Declaration
public Schema.FieldDef this[int index] { get; }
Parameters
Type Name Description
System.Int32 index
Property Value
Type Description
Schema.FieldDef

Item[String]

Returns a field definition by a unique case-insensitive field name within schema

Declaration
public Schema.FieldDef this[string name] { get; }
Parameters
Type Name Description
System.String name
Property Value
Type Description
Schema.FieldDef

Name

For TypedRows, returns a unique fully-qualified row type name, whichs is the global identifier of this schema instance

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

ReadOnly

Specifies that target that this schema represents (i.e. db table) is not updatable so DataStore will not be able to save row changes made in ram

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

SchemaEquivalenceEqualityComparer

Returns an instance of IEqualityComparer(Schema) that performs logical equivalence testing

Declaration
public static IEqualityComparer<Schema> SchemaEquivalenceEqualityComparer { get; }
Property Value
Type Description
System.Collections.Generic.IEqualityComparer<Schema>

TableAttrs

Returns table-level attributes

Declaration
public IEnumerable<TableAttribute> TableAttrs { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<TableAttribute>

TypedRowType

Returns a type of TypedRow if schema was created for TypedRow, or null

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

Methods

FromJSON(JSONDataMap, Boolean)

Declaration
public static Schema FromJSON(JSONDataMap map, bool readOnly = false)
Parameters
Type Name Description
JSONDataMap map
System.Boolean readOnly
Returns
Type Description
Schema

FromJSON(String, Boolean)

Declaration
public static Schema FromJSON(string json, bool readOnly = false)
Parameters
Type Name Description
System.String json
System.Boolean readOnly
Returns
Type Description
Schema

GetEnumerator()

Declaration
public IEnumerator<Schema.FieldDef> GetEnumerator()
Returns
Type Description
System.Collections.Generic.IEnumerator<Schema.FieldDef>

GetFieldDefByBackendName(String, String, Func<Schema.FieldDef, FieldAttribute, Boolean>)

Returns FieldDef by BackendName for TargetName

Declaration
public Schema.FieldDef GetFieldDefByBackendName(string targetName, string backendName, Func<Schema.FieldDef, FieldAttribute, bool> func = null)
Parameters
Type Name Description
System.String targetName
System.String backendName
System.Func<Schema.FieldDef, FieldAttribute, System.Boolean> func
Returns
Type Description
Schema.FieldDef

GetFieldDefByIndex(Int32)

Finds fielddef by name or throws if name is not found

Declaration
public Schema.FieldDef GetFieldDefByIndex(int index)
Parameters
Type Name Description
System.Int32 index
Returns
Type Description
Schema.FieldDef

GetFieldDefByName(String)

Finds fielddef by name or throws if name is not found

Declaration
public Schema.FieldDef GetFieldDefByName(string fieldName)
Parameters
Type Name Description
System.String fieldName
Returns
Type Description
Schema.FieldDef

GetFieldMembers(Type)

Gets all property members of TypedRow that are tagged as [Field]

Declaration
public static IEnumerable<PropertyInfo> GetFieldMembers(Type type)
Parameters
Type Name Description
System.Type type
Returns
Type Description
System.Collections.Generic.IEnumerable<System.Reflection.PropertyInfo>

GetForTypedRow(TypedRow)

Returns schema instance for the TypedRow instance by fetching schema object from cache or creating it if it has not been cached yet

Declaration
public static Schema GetForTypedRow(TypedRow row)
Parameters
Type Name Description
TypedRow row
Returns
Type Description
Schema

GetForTypedRow(Type)

Returns schema instance for the TypedRow instance by fetching schema object from cache or creating it if it has not been cached yet

Declaration
public static Schema GetForTypedRow(Type trow)
Parameters
Type Name Description
System.Type trow
Returns
Type Description
Schema

GetForTypedRow<TRow>()

Returns schema instance for the TypedRow instance by fetching schema object from cache or creating it if it has not been cached yet

Declaration
public static Schema GetForTypedRow<TRow>()where TRow : TypedRow
Returns
Type Description
Schema
Type Parameters
Name Description
TRow

GetKeyFieldDefsForTarget(String)

Returns FieldDefs in their order within rows that are declared as key fields for particular target

Declaration
public IEnumerable<Schema.FieldDef> GetKeyFieldDefsForTarget(string targetName)
Parameters
Type Name Description
System.String targetName
Returns
Type Description
System.Collections.Generic.IEnumerable<Schema.FieldDef>

GetTableAttrForTarget(String)

Returns a TableAttribute that matches the supplied targetName, or if one was not defined then returns TableAttribute which matches any target or null

Declaration
public TableAttribute GetTableAttrForTarget(string targetName)
Parameters
Type Name Description
System.String targetName
Returns
Type Description
TableAttribute

IsEquivalentTo(Schema, Boolean)

Performs logical equivalence testing of two schemas

Declaration
public bool IsEquivalentTo(Schema other, bool compareNames = true)
Parameters
Type Name Description
Schema other
System.Boolean compareNames
Returns
Type Description
System.Boolean

ToString()

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

TryFindFieldByTargetedBackendName(String, String, StringComparison)

Returns a field def that matches the desired backed name for the specified target or null

Declaration
public Schema.FieldDef TryFindFieldByTargetedBackendName(string targetName, string backendName, StringComparison backendNameComparison = StringComparison.OrdinalIgnoreCase)
Parameters
Type Name Description
System.String targetName

Target or null, if null any target assumed

System.String backendName

The name of the backend

System.StringComparison backendNameComparison

The string comparison to use against the backend name, OrdinalIgnoreCase is dflt

Returns
Type Description
Schema.FieldDef

The desired field or null

WriteAsJSON(TextWriter, Int32, JSONWritingOptions)

Writes schema as JSON. 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

INamed
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable
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>)
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)
Back to top Copyright © 2006-2018 Agnicore Inc
Generated by DocFX