Show / Hide Table of Contents

Class FormModel

Represents a "model" (in MVC terms) of a data-entry form. Form models are statically typed - contain fields and can contain "extra amorphous" data

Inheritance
System.Object
Row
TypedRow
AmorphousTypedRow
FormModel
Implements
IConfigurable
IConfigurationPersistent
System.IEquatable<Row>
System.Collections.Generic.IEnumerable<System.Object>
System.Collections.IEnumerable
IValidatable
IJSONWritable
IAmorphousData
Inherited Members
AmorphousTypedRow.AmorphousData
AmorphousTypedRow.BeforeSave(String)
AmorphousTypedRow.AfterLoad(String)
TypedRow.Schema
TypedRow.GetFieldValue(Schema.FieldDef)
TypedRow.SetFieldValue(Schema.FieldDef, Object)
Row.MakeRow(Schema, Type)
Row.TryFillFromJSON(Row, IJSONDataObject, SetFieldFunc)
Row.Item[String]
Row.Item[Int32]
Row.GetDataStoreKey(String)
Row.Configure(IConfigSectionNode)
Row.PersistConfiguration(ConfigSectionNode)
Row.Validate()
Row.Validate(String)
Row.ValidateField(String, String)
Row.ValidateField(String, Schema.FieldDef)
Row.Equals(Row)
Row.Equals(Object)
Row.GetHashCode()
Row.SimpleFilterPredicate(String, Boolean)
Row.IEnumerable.GetEnumerator()
Row.GetEnumerator()
Row.ConvertFieldValueToDef(Schema.FieldDef, Object)
Row.ApplyDefaultFieldValues(String, Boolean)
Row.CopyFields(Row, Boolean, Boolean, Func<String, Schema.FieldDef, Boolean>, Func<String, String, Boolean>)
Row.GetFieldValueDescription(String, String, Boolean)
Row.GetFieldValueDescription(Int32, String, Boolean)
Row.GetDisplayFieldValue(String, String, Func<Object, Object>)
Row.GetDisplayFieldValue(Int32, String, Func<Object, Object>)
Row.GetClientFieldValueList(Object, Schema.FieldDef, String, String)
Row.GetClientFieldDef(Object, Schema.FieldDef, String, String)
Row.GetClientFieldValue(Object, Schema.FieldDef, String, String)
Row.WriteAsJSON(TextWriter, Int32, JSONWritingOptions)
Row.CheckMinMax(FieldAttribute, String, IComparable)
Row.FilterJSONSerializerField(Schema.FieldDef, JSONWritingOptions, String)
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 FormModel : AmorphousTypedRow, IConfigurable, IConfigurationPersistent, IEquatable<Row>, IEnumerable<object>, IEnumerable, IValidatable, IJSONWritable, IAmorphousData

Constructors

FormModel()

Declaration
protected FormModel()

Fields

CSRFToken

Gets/sets CSRF token

Declaration
public string CSRFToken
Field Value
Type Description
System.String

FormMode

Gets/sets form mode - unspecified|insert|edit. This field may be queried by validate and save, i.e. Validate may perform extra cross checks on Insert - i.e. check whether some other user is already registered with the specified email in this form etc.

Declaration
public FormMode FormMode
Field Value
Type Description
FormMode

JSON_CSRF_PROPERTY

Declaration
public const string JSON_CSRF_PROPERTY = "__CSRFToken"
Field Value
Type Description
System.String

JSON_MODE_PROPERTY

Declaration
public const string JSON_MODE_PROPERTY = "__FormMode"
Field Value
Type Description
System.String

JSON_ROUNDTRIP_PROPERTY

Declaration
public const string JSON_ROUNDTRIP_PROPERTY = "__Roundtrip"
Field Value
Type Description
System.String

Properties

AmorphousDataEnabled

False by default for forms, safer for web. For example, no injection of un-inteded fields can be done via web form post

Declaration
public override bool AmorphousDataEnabled { get; }
Property Value
Type Description
System.Boolean
Overrides
AmorphousTypedRow.AmorphousDataEnabled

DataStoreTargetName

Returns the name of data store target obtained from App.DataStore by default. Override to supply a different name. This property is used for validation

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

HasRoundtripBag

True if RoundtripBag is allocated

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

RoundtripBag

Returns lazily-allocated RoundtripBag. Use HasRoundtripBag to see if it is allocated not to allocate on get

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

Methods

DoSave(out Object)

Override to save model into data store. Return "predictable" exception (such as key violation) as a value instead of throwing. Throw only in "un-predictable" cases (such as DB connection is down, not enough space etc...). Return extra result obtained during save i.e. a db-assigned auto-inc field

Declaration
protected abstract Exception DoSave(out object saveResult)
Parameters
Type Name Description
System.Object saveResult
Returns
Type Description
System.Exception

Save(out Object)

Saves form into data store. The form is validated first and validation error is returned which indicates that save did not succeed due to validation error/s. The core implementation is in DoSave() that can also abort by either returning execption when predictable failure happens on save (i.e. key violation). Other exceptions are thrown. Returns extra result obtained during save i.e. a db-assigned auto-inc field

Declaration
public virtual Exception Save(out object saveResult)
Parameters
Type Name Description
System.Object saveResult
Returns
Type Description
System.Exception

Save<TSaveResult>(out TSaveResult)

Saves form into data store. The form is validated first and validation error is returned which indicates that save did not succeed due to validation error/s. The core implementation is in DoSave() that can also abort by either returning execption when predictable failure happens on save (i.e. key violation). Other exceptions are thrown. Returns extra result obtained during save i.e. a db-assigned auto-inc field

Declaration
public virtual Exception Save<TSaveResult>(out TSaveResult saveResult)
Parameters
Type Name Description
TSaveResult saveResult
Returns
Type Description
System.Exception
Type Parameters
Name Description
TSaveResult

SetRoundtripBagFromJSONString(String)

If non null or empty parses JSON content and sets the RoundtripBag

Declaration
public void SetRoundtripBagFromJSONString(string content)
Parameters
Type Name Description
System.String content

Implements

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

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