Class AmorphousDynamicDoc
Represents a data document which has a schema only known at run-time that also implements IAmorphousData interface that allows this row to store "extra" data that does not comply with the current schema. Dynamic docs store data in object[] internally, providing better flexibility(ability to define schema at runtime) than TypedDocs at the expense of performance. This class is not sealed so implementors may override configuration persistence
Implements
Inherited Members
Namespace: Azos.Data
Assembly: Azos.dll
Syntax
[Serializable]
public class AmorphousDynamicDoc : DynamicDoc, IConfigurable, IConfigurationPersistent, IEquatable<Doc>, IEnumerable<object>, IEnumerable, IValidatable, IJSONWritable, IAmorphousData
Constructors
AmorphousDynamicDoc(Schema)
Declaration
public AmorphousDynamicDoc(Schema schema)
Parameters
Type | Name | Description |
---|---|---|
Schema | schema |
Properties
AmorphousData
Returns data that does not comply with known schema (dynamic data). The field names are NOT case-sensitive
Declaration
public IDictionary<string, object> AmorphousData { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.String, System.Object> |
AmorphousDataEnabled
True by default for rows
Declaration
public virtual bool AmorphousDataEnabled { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
AfterLoad(String)
Invoked to allow the doc to hydrate its fields/state from AmorphousData bag. For example, this may be used to reconstruct some temporary object state that is not stored as a part of established business schema. The operation is performed per particular targetName (name of physical backend). Simply put, this method allows business code to "specify what to do after object gets loaded from THE PARTICULAR TARGET backend store". An example: suppose current MongoDB collection stores 3 fields for name, and we want to collapse First/Last/Middle name fields into one field. If we change rowschema then it will only contain 1 field which is not present in the database, however those 'older' fields will get populated into AmorphousData giving us an option to merge older 3 fields into 1 within AfterLoad() implementation
Declaration
public virtual void AfterLoad(string targetName)
Parameters
Type | Name | Description |
---|---|---|
System.String | targetName |
BeforeSave(String)
Invoked to allow the doc to transform its state into AmorphousData bag. For example, this may be usefull to store extra data that is not a part of established business schema. The operation is performed per particular targetName (name of physical backend). Simply put, this method allows business code to "specify what to do before object gets saved in THE PARTICULAR TARGET backend store"
Declaration
public virtual void BeforeSave(string targetName)
Parameters
Type | Name | Description |
---|---|---|
System.String | targetName |