Table of Contents

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

DynamicAccessor

BodyType

BaseDocument<T>'s Body type resulting from DocumentSchema.

Type BodyType { get; }

Property Value

Type

EmptyBody

Empty body object of Type: BodyType.

object EmptyBody { get; }

Property Value

object

EvalTypeIndex

Evaluation context type index.

IReadOnlyDictionary<string, Type> EvalTypeIndex { get; }

Property Value

IReadOnlyDictionary<string, Type>

Schema

DocumentSchema Schema { get; }

Property Value

DocumentSchema

Sid

Schema type Id.

string Sid { get; }

Property Value

string

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 TDoc
ecx ISchemaEvalContext
body 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 object
ecx ISchemaEvalContext
rule 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 TDoc
ecx ISchemaEvalContext
rule 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

ecx ISchemaEvalContext

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

object

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

IDictionary<string, object>

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 TDoc
props 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

doc TDoc
bodyObj object
setupData Func<object, IDictionary<string, object>>
bufSz int

Returns

object

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.)