Data Export Workflow
This guide shows how to turn in-memory objects into clean export files with intentional column names, ordering, and formatting.
The main package combination is:
VersaTul.Collection.Streamersfor creating the export stream.VersaTul.Display.Attributesfor naming, ordering, and formatting the output.VersaTul.Object.Convertersfor flattening and preparing object data for export-friendly processing.
When To Use This Workflow
Use this workflow when you need to:
Export collections to CSV, JSON, or tab-delimited output.
Control the shape of exported columns without renaming your model properties.
Keep export formatting decisions near the model instead of scattering them through file-writing code.
Packages To Install
dotnet add package VersaTul.Collection.Streamers
dotnet add package VersaTul.Display.Attributes
dotnet add package VersaTul.Object.Converters
Step 1: Annotate The Export Model
Use display metadata to control how the export appears.
using VersaTul.Display.Attributes;
public class OrderExportRow
{
[Display(Name = "Order Id", Sequence = 1)]
public int OrderId { get; set; }
[Display(Name = "Customer", Sequence = 2)]
public string CustomerName { get; set; }
[Display(Name = "Order Total", Decimals = 2, Sequence = 3)]
public decimal Total { get; set; }
[Display(DateFormattingString = "yyyy-MM-dd", Sequence = 4)]
public DateTime OrderedOn { get; set; }
[Display(Ignore = true)]
public string InternalNotes { get; set; }
}
Step 2: Create The Stream
Create a streamer for the target format.
using VersaTul.Collection.Streamers;
var csvStreamer = new CsvStreamer(utility, fileUtility, flattener);
using var fileStream = csvStreamer
.Create(orderRows, "orders-export")
.GetFileStream();
This is the point where Collection.Streamers uses the companion packages to turn your object model into exportable output.
Step 3: Save The Export
For large exports, write directly to disk.
using VersaTul.Collection.Streamers.Contracts;
var filePath = ((IFileWritableStreamer)csvStreamer.Create(orderRows, "orders-export"))
.WriteToFile("C:\\exports");
Why The Companion Packages Matter
Display.Attributes lets you control the final output contract.
Object.Converters helps flatten nested values and respects display-driven behavior during processing.
Collection.Streamers provides the reusable export engine.
Together, they give you a path from domain object to export file without hand-writing CSV headers, formatting logic, and flattening rules.
What You Should See
When this workflow is working:
The output columns reflect display names rather than raw property names.
Values such as decimals and dates follow the export formatting rules.
Ignored properties do not appear in the final export.
Common Mistakes
Using
Collection.Streamersalone when the export also needs friendly column names and formatting.Encoding formatting rules in ad hoc exporter code instead of display metadata.
Forgetting that direct-to-disk writing is often the better choice for large files.
What To Read Next
Read Collection Streamers for format and file-writing options.
Read Display Attributes for metadata and custom formatter details.
Read Object Converters if your export input contains nested objects or collections that must be flattened first.