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
FormModel
Implements
System.Collections.Generic.IEnumerable<System.Object>
System.Collections.IEnumerable
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()
Assembly: NFX.dll
[Serializable]
public abstract class FormModel : AmorphousTypedRow, IConfigurable, IConfigurationPersistent, IEquatable<Row>, IEnumerable<object>, IEnumerable, IValidatable, IJSONWritable, IAmorphousData
Constructors
Declaration
Fields
Declaration
Field Value
Type |
Description |
System.String |
|
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
Field Value
Declaration
public const string JSON_CSRF_PROPERTY = "__CSRFToken"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string JSON_MODE_PROPERTY = "__FormMode"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string JSON_ROUNDTRIP_PROPERTY = "__Roundtrip"
Field Value
Type |
Description |
System.String |
|
Properties
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
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 |
|
True if RoundtripBag is allocated
Declaration
public bool HasRoundtripBag { get; }
Property Value
Type |
Description |
System.Boolean |
|
Returns lazily-allocated RoundtripBag.
Use HasRoundtripBag to see if it is allocated not to allocate on get
Declaration
public JSONDataMap RoundtripBag { get; }
Property Value
Methods
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 |
|
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 |
|
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 |
|
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
System.IEquatable<T>
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable
Extension Methods