Closed daveaglick closed 5 years ago
After playing around with this, I think I've got a better idea that won't require quite as much infrastructure work:
IContentProvider
interface and refactor all the GetDocument()
and document factory methods/constructors to take that instead of a string or stream. It should have a IContentProvider.GetStream()
method and be disposable (more on that below).StringContentProvider
, StreamContentProvider
, and FileContentProvider
. Each implementation should have implicit conversion operators so you can just pass a IFile
for example to the document factory methods.Done in the vnext branch.
After changing to a more parallel execution model in #486 combined with other issues like keeping too many open streams for file-based documents (#805), I think a total rework of this needs to be done before v3.
DocumentFactory
IExecutionContext.GetDocument()
methodsDocument
toWyam.Common
for use as a base document type and make it abstractIDocument
/Document
should have methods to clone the document with new metadata (keeping the content stream, string, etc.)StringDocument
(which should continue to use the option of keeping content in memory or on disk),StreamDocument
, andFileDocument
- these are what modules should instantiateIDocument.GetStream()
method should lazily create the appropriate stream for the document (no moreBlockingStream
and other shenanigans, other than maybe for theStreamDocument
)Document
everywhere instead ofIDocument
which will let the baseDocument
class do things like track instantiation and disposal.