Interface IDocSchemaProcessor
- Namespace
- Tlabs.Data.Processing
- Assembly
- Tlabs.Data.dll
DocumentSchema processor interface.
public interface IDocSchemaProcessor
- Extension Methods
Properties
BodyAccessor
DynamicAccessor to the body type.
DynamicAccessor BodyAccessor { get; }
Property Value
BodyType
BaseDocument<T>'s Body type resulting from DocumentSchema.
Type BodyType { get; }
Property Value
EmptyBody
Empty body object of Type: BodyType.
object EmptyBody { get; }
Property Value
EvalTypeIndex
Evaluation context type index.
IReadOnlyDictionary<string, Type> EvalTypeIndex { get; }
Property Value
Schema
DocumentSchema Schema { get; }
Property Value
Sid
Schema type Id.
string Sid { get; }
Property Value
Methods
ApplyValidation<TDoc>(TDoc, ISchemaEvalContext, out object)
Check doc
against the validation rules (with validation context ecx
)
and applies the result to the document status properties.
void ApplyValidation<TDoc>(TDoc doc, ISchemaEvalContext ecx, out object body) where TDoc : BaseDocument<TDoc>
Parameters
doc
TDocecx
ISchemaEvalContextbody
object
Type Parameters
TDoc
CheckValidation(object, ISchemaEvalContext, out ValidationRule)
Check body
object against the validation rules.
bool CheckValidation(object body, ISchemaEvalContext ecx, out DocumentSchema.ValidationRule rule)
Parameters
body
objectecx
ISchemaEvalContextrule
DocumentSchema.ValidationRule
Returns
- bool
true if valid. If invalid (false) the offending rule is set in
rule
.
CheckValidation<TDoc>(TDoc, ISchemaEvalContext, out ValidationRule)
Check doc
against the validation rules (with validation context ecx
).
bool CheckValidation<TDoc>(TDoc doc, ISchemaEvalContext ecx, out DocumentSchema.ValidationRule rule) where TDoc : BaseDocument<TDoc>
Parameters
doc
TDocecx
ISchemaEvalContextrule
DocumentSchema.ValidationRule
Returns
- bool
true if valid. If invalid (false) the offending rule is set in
rule
.
Type Parameters
TDoc
EvaluateComputedFields(ISchemaEvalContext)
Evaluate computed schema fields.
void EvaluateComputedFields(ISchemaEvalContext ecx)
Parameters
LoadBodyObject<TDoc>(TDoc)
Return doc
's Body as object (according to its DocumentSchema).
object LoadBodyObject<TDoc>(TDoc doc) where TDoc : BaseDocument<TDoc>
Parameters
doc
TDoc
Returns
Type Parameters
TDoc
LoadBodyProperties<TDoc>(TDoc)
Return doc
's Body properties (according to its DocumentSchema).
IDictionary<string, object?> LoadBodyProperties<TDoc>(TDoc doc) where TDoc : BaseDocument<TDoc>
Parameters
doc
TDoc
Returns
Type Parameters
TDoc
MergeBodyProperties<TDoc>(TDoc, IEnumerable<KeyValuePair<string, object?>>, ISchemaEvalContext?)
Merge props
into doc
's Body with optionalcx
.
object? MergeBodyProperties<TDoc>(TDoc doc, IEnumerable<KeyValuePair<string, object?>> props, ISchemaEvalContext? cx = null) where TDoc : BaseDocument<TDoc>
Parameters
doc
TDocprops
IEnumerable<KeyValuePair<string, object>>cx
ISchemaEvalContext
Returns
- object
Updated body object.
Type Parameters
TDoc
Remarks
To omit any validation and field computation pass Instance as cx
UpdateBodyObject<TDoc>(TDoc, object, Func<object, IDictionary<string, object?>>?, int)
Update doc
's Body with bodyObj
.
object UpdateBodyObject<TDoc>(TDoc doc, object bodyObj, Func<object, IDictionary<string, object?>>? setupData = null, int bufSz = 10240) where TDoc : BaseDocument<TDoc>
Parameters
Returns
Type Parameters
TDoc
Remarks
By specifying a setupData
delegate the caller can provide a custom dictionary of data beeing imported into
the CalcNgn model. (Defaults to a dictionary representing all public properties of the bodyObj
.)