DataContextImpl
Namespace: Meshmakers.Octo.Sdk.Common.EtlDataPipeline
Default IDataContext implementation backed by a single layered DataOverlay over an IReadSource. The same class serves both the root context (read base is a zero-copy via ElementSource) and iteration children (read base is the parent fallback chain plus aliases via LayeredSource); the only difference is which source and which constructor produced the instance. Exposes a path-only API for ETL pipeline nodes; no JSON object types appear on the public surface.
public sealed class DataContextImpl : IDataContext, IDisposable
Inheritance Object → DataContextImpl
Implements IDataContext, IDisposable
Properties
Parent
public IDataContext Parent { get; }
Property Value
Constructors
DataContextImpl(JsonElement)
Creates a new context wrapping the given baseElement. The caller
retains ownership of the underlying .
public DataContextImpl(JsonElement baseElement)
Parameters
baseElement JsonElement
DataContextImpl(JsonDocument)
Creates a new context that takes ownership of the given document.
public DataContextImpl(JsonDocument document)
Parameters
document JsonDocument
DataContextImpl()
Creates a new context with an empty JSON object as the base document.
public DataContextImpl()
Methods
Exists(String)
public bool Exists(string path)
Parameters
path String
Returns
GetKind(String)
public DataKind GetKind(string path)
Parameters
path String
Returns
Length(String)
public int Length(string path)
Parameters
path String
Returns
Keys(String)
public IEnumerable<string> Keys(string path)
Parameters
path String
Returns
Get<T>(String)
public T Get<T>(string path)
Type Parameters
T
Parameters
path String
Returns
T
GetArray<T>(String)
public IEnumerable<T> GetArray<T>(string path)
Type Parameters
T
Parameters
path String
Returns
GetValue(String, Boolean)
public object GetValue(string path, bool parseDateStrings)
Parameters
path String
parseDateStrings Boolean
Returns
TryGet<T>(String, out T)
public bool TryGet<T>(string path, out T value)
Type Parameters
T
Parameters
path String
value T
Returns
Set<T>(String, T)
public void Set<T>(string path, T value)
Type Parameters
T
Parameters
path String
value T
Set<T>(String, T, DocumentModes, ValueKinds, TargetValueWriteModes)
public void Set<T>(string path, T value, DocumentModes documentMode, ValueKinds valueKind, TargetValueWriteModes writeMode)
Type Parameters
T
Parameters
path String
value T
documentMode DocumentModes
valueKind ValueKinds
writeMode TargetValueWriteModes
Clear(String)
public void Clear(string path)
Parameters
path String
IterateArrayAsync(String, Func<IDataContext, Task>)
public Task IterateArrayAsync(string path, Func<IDataContext, Task> body)
Parameters
path String
Returns
IterateArrayAsync(String, IReadOnlyList<ValueTuple<String, String>>, Func<IDataContext, Task>)
public Task IterateArrayAsync(string path, IReadOnlyList<ValueTuple<string, string>> aliases, Func<IDataContext, Task> body)
Parameters
path String
aliases IReadOnlyList<ValueTuple<String, String>>
Returns
IterateObjectAsync(String, Func<String, IDataContext, Task>)
public Task IterateObjectAsync(string path, Func<string, IDataContext, Task> body)
Parameters
path String
body Func<String, IDataContext, Task>
Returns
IterateMatchesAsync(String, Func<IDataContext, Task>)
public Task IterateMatchesAsync(string jsonPath, Func<IDataContext, Task> body)
Parameters
jsonPath String
Returns
UpdateMatchesAsync(String, Func<IDataContext, Task>)
public Task UpdateMatchesAsync(string jsonPath, Func<IDataContext, Task> body)
Parameters
jsonPath String
Returns
Select(String)
public IDataContext Select(string path)
Parameters
path String
Returns
SelectMatches(String)
public IEnumerable<IDataContext> SelectMatches(string jsonPath)
Parameters
jsonPath String
Returns
CopyTo(String, String)
public void CopyTo(string sourcePath, string targetPath)
Parameters
sourcePath String
targetPath String
WriteJsonTo(String, Stream)
public void WriteJsonTo(string path, Stream destination)
Parameters
path String
destination Stream
SetFromJson(String, ReadOnlyMemory<Byte>)
public void SetFromJson(string path, ReadOnlyMemory<byte> utf8Json)
Parameters
path String
utf8Json ReadOnlyMemory<Byte>
CreateIterationChild(IReadOnlyList<ValueTuple<String, JsonElement>>)
Creates a child context for zero-copy iteration scenarios. The child reads from alias entries first, then falls back to the parent for everything else. Writes on the child stay isolated in the child's overlay and do not escape to the parent.
internal IDataContext CreateIterationChild(IReadOnlyList<ValueTuple<string, JsonElement>> aliases)
Parameters
aliases IReadOnlyList<ValueTuple<String, JsonElement>>
Returns
Dispose()
Releases the owned by this context, if any. Idempotent. Constructors that take an externally-owned , and the iteration-child constructor, hold no document — Dispose is a no-op for those.
public void Dispose()