-
Notifications
You must be signed in to change notification settings - Fork 136
Tutorial
Cinchoo edited this page May 27, 2017
·
14 revisions
Cinchoo ETL can be downloaded from NuGet.
Use the GUI or the following command in the Package Manager Console:
Install-Package ChoETL
Add namespace to the program
using ChoETL;
That's it, you are ready to use Cinchoo ETL for extracting and generating various formatted files.
To load any file (CSV, FixedLength, Xml), simple use the appropriate reader component to parse it. Sample below shows how to load CSV file (Emp.csv)
1,Tom
2,Carl
3,Mark
foreach (var e in new ChoCSVReader("Emp.csv"))
Console.WriteLine(e.ToStringEx());
var reader = new ChoCSVReader("Emp.csv");
object rec = null;
while ((rec = reader.Read()) != null)
Console.WriteLine(rec.ToStringEx());
To generate any file (CSV, FixedLength, Xml), simple use the appropriate writer component to generate it. Sample below shows how to create CSV file (Emp.csv)
1,Mark
2,Jason
List<ExpandoObject> objs = new List<ExpandoObject>();
dynamic rec1 = new ExpandoObject();
rec1.Id = 1;
rec1.Name = "Mark";
objs.Add(rec1);
dynamic rec2 = new ExpandoObject();
rec2.Id = 2;
rec2.Name = "Jason";
objs.Add(rec2);
using (var parser = new ChoCSVWriter("Emp.csv"))
{
parser.Write(objs);
}
using (var parser = new ChoCSVWriter("Emp.csv"))
{
dynamic rec1 = new ExpandoObject();
rec1.Id = 1;
rec1.Name = "Mark";
parser.Write(item);
dynamic rec1 = new ExpandoObject();
rec1.Id = 2;
rec1.Name = "Jason";
parser.Write(item);
}
©2017 Cinchoo Inc