![]() |
VOOZH | about |
dotnet add package Sylvan.Data --version 0.2.17
NuGet\Install-Package Sylvan.Data -Version 0.2.17
<PackageReference Include="Sylvan.Data" Version="0.2.17" />
<PackageVersion Include="Sylvan.Data" Version="0.2.17" />Directory.Packages.props
<PackageReference Include="Sylvan.Data" />Project file
paket add Sylvan.Data --version 0.2.17
#r "nuget: Sylvan.Data, 0.2.17"
#:package Sylvan.Data@0.2.17
#addin nuget:?package=Sylvan.Data&version=0.2.17Install as a Cake Addin
#tool nuget:?package=Sylvan.Data&version=0.2.17Install as a Cake Tool
A .NET library for working with data. Provides implementations of, and extensions for, DbDataReader.
All of the data operations are designed to support streaming, so large data sets don't need to fit in memory.
Contains a general purpose data binder that can bind DbDataReader records to object instances.
The following example binds CSV data using Sylvan.Data.Csv library to strongly-typed C# Record instances.
using Sylvan.Data;
using Sylvan.Data.Csv;
using System.Linq;
using var dr = CsvDataReader.Create("data.csv");
IEnumerable<Record> records = dr.GetRecords<Record>();
Record[] allRecords = records.ToArray();
class Record {
public int Id { get; set; }
public string Name { get; set; }
public DateTime Date { get; set; }
public decimal Amount { get; set; }
}
The IEnumerable<T>.AsDataReader extension method provides the inverse of the databinder,
exposing object instances as a DbDataReader.
This example demonstrates using the Sylvan.Data.Csv library to write object data.
IEnumerable<Record> records = GetRecords();
DbDataReader reader = records.AsDataReader();
CsvDataWriter csvWriter = CsvDataWriter.Create("records.csv");
csvWriter.Write(reader);
The library includes various LINQ-like extension methods for DbDataReader.
Select
Creates a DbDataReader that exposes a subset of the columns.
Where
Creates a DbDataReader that filters rows.
Skip/Take
Creates a DbDataReader that skips rows, or limits the rows read.
WithColumns
Creates a DbDataReader with additional columns attached.
This example shows how to use some of these methods in a CSV data loading operation.
using Sylvan.Data;
string csvFile = "data.csv";
var importDate = DateTime.UtcNow;
var csv = CsvDataReader.Create(csvFile);
DbDataReader dr =
csv
// select some of the columns from the csv file
.Select("Id", "Name", "Date", "Value")
// filter to just records from the last week
.Where(d => d.GetDateTime(2) >= importDate.AddDays(-7))
// add columns with information about the data source
.WithColumns(
new CustomDataColumn<string>("SourceFile", r => csvFile),
new CustomDataColumn<DateTime>("ImportDate", r => importDate),
new CustomDataColumn<int>("RowNum", r => csv.RowNumber)
)
// limit to 10k records
.Take(10000);
LoadData(dr);
The Schema type provides methods to building and de/serializing data schema information.
This can be used to attach schema information to weakly typed data files, like CSV and Excel data,
using the Sylvan.Data.Csv and Sylvan.Data.Excel package.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 is compatible. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 3 NuGet packages that depend on Sylvan.Data:
| Package | Downloads |
|---|---|
|
GreatUtilities.Infrastructure
Essencial tools to agile development. |
|
|
Sylvan.AspNetCore.Mvc.Csv
Package Description |
|
|
Sylvan.AspNetCore.Mvc.Excel
Package Description |
Showing the top 3 popular GitHub repositories that depend on Sylvan.Data:
| Repository | Stars |
|---|---|
|
LykosAI/StabilityMatrix
Multi-Platform Package Manager for Stable Diffusion
|
|
|
nietras/Sep
World's Fastest .NET CSV Parser. Modern, minimal, fast, zero allocation, reading and writing of separated values (`csv`, `tsv` etc.). Cross-platform, trimmable and AOT/NativeAOT compatible with blazing fast SIMD vectorized parsing.
|
|
|
MarkPflug/Sylvan.Data.Excel
The fastest .NET library for reading Excel data files.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 0.2.17 | 47,181 | 4/7/2026 |
| 0.2.16 | 505,102 | 7/2/2024 |
| 0.2.15 | 5,127 | 6/20/2024 |
| 0.2.14 | 1,208 | 6/13/2024 |
| 0.2.13 | 49,596 | 2/6/2024 |
| 0.2.13-b0001 | 7,303 | 11/17/2023 |
| 0.2.12 | 148,775 | 4/25/2023 |
| 0.2.12-B0002 | 296 | 4/20/2023 |
| 0.2.12-B0001 | 304 | 4/7/2023 |
| 0.2.11 | 152,799 | 2/17/2023 |
| 0.2.10 | 4,588 | 1/16/2023 |
| 0.2.9 | 39,634 | 12/29/2022 |
| 0.2.8 | 30,749 | 11/8/2022 |
| 0.2.7 | 11,939 | 10/11/2022 |
| 0.2.6 | 3,586 | 9/23/2022 |
| 0.2.5 | 1,903 | 9/12/2022 |
| 0.2.4 | 682 | 9/8/2022 |
| 0.2.3 | 6,549 | 7/29/2022 |
| 0.2.2 | 349,800 | 6/14/2022 |
| 0.2.1 | 1,875 | 5/31/2022 |