Class RdlDefinitionWriter
Writes a ReportDefinition back out as a report definition.
public sealed class RdlDefinitionWriter
- Inheritance
-
RdlDefinitionWriter
- Inherited Members
Remarks
Output is deterministic: the same definition writes the same bytes on every run, on
every target framework. There are no timestamps and no generated identifiers — in
particular rd:ReportID, which Report Designer refreshes on every save, is written
only if the definition already carries one.
Why this serializes by hand instead of using XmlWriter. Namespace
declarations are part of what a definition says. XmlWriter owns prefix binding: it
emits declarations where it first needs them and silently discards one the document never
uses, which for a designer's save is a change the author did not ask for. Writing the
declarations as the attributes they are keeps them where the author put them, including the
unused ones.
Every name it writes is in scope. Where an element's or attribute's namespace is not what
its prefix (or, for an unprefixed element, the default namespace) is bound to at that point, the writer
adds the declaration that binds it, on that element. A definition the reader produced already declares
everything it uses, so this adds nothing to it and its bytes are unchanged; a definition built in code —
a new Report root, an rd: element a designer added — is written with the declarations its
names need, because a file without them puts every element in no namespace, and Reporting Services
refuses it: "The report definition has an invalid target namespace '' which cannot be upgraded."
Constructors
- RdlDefinitionWriter()
Initializes a writer with default settings.
- RdlDefinitionWriter(RdlDefinitionWriteSettings)
Initializes a writer.
Methods
- Write(ReportDefinition, Stream)
Writes a definition to a stream.