Using the DAS .NET API is very easy. Below we will describe the steps needed to create a simple job application.
Step 1: Create a New Microsoft Visual Studio 2005 Project
Open Visual Studio 2005 and go to File > New > Project... and select Visual C# > Console Application.
Step 2: Add the Ecrion DAS References

Go to Project > Add Reference... and select Ecrion.DAS.NET in the list as shown in the screenshot above, then click OK.
Step 3: Type In The Code
First make sure that you have a valid xml input job. Valid input jobs can be found in Samples folder.
Then copy the code listed below into the Program.cs file and hit F5 or Debug > Run and a xml file jobOut.xml will be written on your C:\ drive. Remember to first make sure that you have write access on C:\.
using System;
using System.Collections.Generic;
using System.Text;
using Ecrion.DAS;
using System.IO;
namespace TestDAS
{
class Program
{
static void Main(string[] args)
{
try
{
Engine engine = new Engine();
//Make sure that the path to the job is valid!!!
FileStream jobStream = new FileStream(
@"C:\Program Files\Ecrion\Data Aggregation Server 2010\Samples\Job Samples\SimpleJob.dax",
FileMode.Open, FileAccess.Read);
//parameters for the processing operation.
JobParameters param = new JobParameters();
//set connection string(make sure that the path to the database is valid!!!)
String connStr = String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0}", @"C:\Program Files\Ecrion\Data Aggregation Server 2010\Samples\Database Samples\emp.mdb");
param.JobPropertyList.Add(new JobProperty("con1", "connection-string", connStr));
using (FileStream outputStream = new FileStream("C:\\jobOut.xml", FileMode.Create))
engine.Aggregate(jobStream, outputStream, param);
Console.WriteLine("Output xml is ready!\n");
}
catch (Exception e)
{ // Report any errors that may occur
Console.WriteLine(e);
}
}
}
}
Understanding the Code
First create our Engine object:
// create a new engine
Engine engine = new Engine();
Next, we'll need an input job stream. SimpleJob.dax is a simple job sample form the Sample folder. You got to make sure that the path to the job is correct since the installation folder may be different.
//Make sure that the path to the job is valid!!!
FileStream jobStream = new FileStream(
@"C:\Program Files\Ecrion\Data Aggregation Server 2010\Job Samples\SimpleJob.dax",
FileMode.Open, FileAccess.Read);
Set some job parameters. Job Parameters are used to overwrite some key resources in your job, like connection-strings, web-service urls etc. The
purpose is to use the same job with various data sources, or to hide some critical aspects of your jobs (like username and password from xml job).
In this sample we will overwrite the connection string from job <das:database-connection> element with the id conn1.
JobParameters param = new JobParameters();
//set connection string(make sure that the path to the database is valid!!!)
String connStr = String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0}", @"C:\Program Files\Ecrion\Data Aggregation Server 2010\Database Samples\emp.mdb");
param.JobPropertyList.Add(new JobProperty("con1", "connection-string", connStr));
Now we'll create an output stream (we'll use a FileStream in this example) and call the Aggregate() method on our Engine object.
using (FileStream outputStream = new FileStream("C:\\jobOut.xml", FileMode.Create))
engine.Aggregate(jobStream, outputStream, param);