Method WithEditWriter
- Namespace
- IntentSharp
- Assembly
- IntentSharp.dll
WithEditWriter(Func<IEditWriter, IEditWriter>)
Wraps the writer the client's edits go to, so you decide what an edit the library originates does once its
document's validators pass it: WithEditWriter(inner => new MyReviewWriter(inner)). The innermost writer is
an ApplyingEditWriter, which saves the edit and makes it run. Several calls compose: each later wrap
receives the writer the earlier ones produced. A wrap runs once per built client, when Build() runs.
The edit seam writes to the client's document store, so a wrap needs one: Build() throws
InvalidOperationException when a wrap is registered and the client has no document store (add one
with WithDocumentStore(IDocumentStore)), and when a wrap returns null. With a mapping store, the wrap also receives
every replacement of a compiled mapping.
public IntentClientBuilder WithEditWriter(Func<IEditWriter, IEditWriter> wrap)
Parameters
wrapFunc<IEditWriter, IEditWriter>Receives the writer built so far and returns the writer to use, typically one that calls it.
Returns
Exceptions
- ArgumentNullException
wrapis null.