diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7ed90b4..27e580f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,8 @@
+## 4.10.0 (2020-10-06)
+**Summary** - Add the ability to explicitly write the schema using typed writers.
+
+I never added support for writing the schema using typed writers. I never added `WriteSchema` and `WriteSchemaAsync` to the `IWriter` interface either. I don't see why not, so I added them.
+
## 4.9.0 (2020-09-26)
**Summary** - Make OnParsing, OnParsed, OnFormatting, OnFormatted events available to type mappings.
diff --git a/FlatFiles/FlatFiles.csproj b/FlatFiles/FlatFiles.csproj
index 467ea6f..d888413 100644
--- a/FlatFiles/FlatFiles.csproj
+++ b/FlatFiles/FlatFiles.csproj
@@ -10,17 +10,17 @@
https://github.com/jehugaleahsa/FlatFiles.git
git
csv;comma;tab;separated;value;delimited;flat;file;fixed;width;fixed-width;length;fixed-length;parser;parsing;parse
- Allowing configuring OnParsing, OnParsed, OnFormatting, OnFormatted events with type mappings. Raise events when processing ignored columns.
+ Allow explicitly writing the schema using typed mappers.
true
FlatFiles.snk
- 4.9.0
+ 4.10.0
8.0
- 4.9.0.0
- 4.9.0.0
+ 4.10.0.0
+ 4.10.0.0
UNLICENSE.txt
icon.png
diff --git a/FlatFiles/IWriter.cs b/FlatFiles/IWriter.cs
index b1c3789..77aaa1d 100644
--- a/FlatFiles/IWriter.cs
+++ b/FlatFiles/IWriter.cs
@@ -24,6 +24,18 @@ public interface IWriter
/// The schema being used by the builder to create the textual representation.
ISchema GetSchema();
+ ///
+ /// Write the textual representation of the record schema.
+ ///
+ /// If the header or records have already been written, this call is ignored.
+ void WriteSchema();
+
+ ///
+ /// Write the textual representation of the record schema.
+ ///
+ /// If the header or records have already been written, this call is ignored.
+ Task WriteSchemaAsync();
+
///
/// Writes the textual representation of the given values to the writer.
///
diff --git a/FlatFiles/SeparatedValueWriter.cs b/FlatFiles/SeparatedValueWriter.cs
index 2ff4483..6309164 100644
--- a/FlatFiles/SeparatedValueWriter.cs
+++ b/FlatFiles/SeparatedValueWriter.cs
@@ -108,7 +108,7 @@ ISchema IWriter.GetSchema()
}
///
- /// Write the textual representation of the record schema to the writer.
+ /// Write the textual representation of the record schema.
///
/// If the header or records have already been written, this call is ignored.
public void WriteSchema()
diff --git a/FlatFiles/TypeMapping/TypedWriter.cs b/FlatFiles/TypeMapping/TypedWriter.cs
index c602444..8c784df 100644
--- a/FlatFiles/TypeMapping/TypedWriter.cs
+++ b/FlatFiles/TypeMapping/TypedWriter.cs
@@ -32,6 +32,18 @@ public interface ITypedWriter
/// The schema being used by the writer.
ISchema GetSchema();
+ ///
+ /// Write the textual representation of the record schema.
+ ///
+ /// If the header or records have already been written, this call is ignored.
+ void WriteSchema();
+
+ ///
+ /// Write the textual representation of the record schema to the writer.
+ ///
+ /// If the header or records have already been written, this call is ignored.
+ Task WriteSchemaAsync();
+
///
/// Writes the given entity to the underlying document.
///
@@ -84,6 +96,16 @@ public ISchema GetSchema()
return writer.GetSchema();
}
+ public void WriteSchema()
+ {
+ writer.WriteSchema();
+ }
+
+ public async Task WriteSchemaAsync()
+ {
+ await writer.WriteSchemaAsync().ConfigureAwait(false);
+ }
+
public void Write(TEntity entity)
{
var values = Serialize(entity);
@@ -146,6 +168,16 @@ public ISchema GetSchema()
return null;
}
+ public void WriteSchema()
+ {
+ writer.WriteSchema();
+ }
+
+ public async Task WriteSchemaAsync()
+ {
+ await writer.WriteSchemaAsync().ConfigureAwait(false);
+ }
+
public void Write(object entity)
{
var values = Serialize(entity);
diff --git a/FlatFiles/TypeMapping/UntypedWriter.cs b/FlatFiles/TypeMapping/UntypedWriter.cs
index 86a62f1..ee44e6f 100644
--- a/FlatFiles/TypeMapping/UntypedWriter.cs
+++ b/FlatFiles/TypeMapping/UntypedWriter.cs
@@ -37,6 +37,16 @@ public ISchema GetSchema()
return writer.GetSchema();
}
+ public void WriteSchema()
+ {
+ writer.WriteSchema();
+ }
+
+ public async Task WriteSchemaAsync()
+ {
+ await writer.WriteSchemaAsync().ConfigureAwait(false);
+ }
+
public void Write(object entity)
{
writer.Write((TEntity)entity);