# Connect Data Engine to Objects

An easy tutorial to connect dataengine to data objects.

## Content

With the **Data Engine** library, you can import data from a collection of objects of a specific class type to the DataEngine table.
To connect **Data Engine** to **Objects**, you need to follow the steps given below:

1. Initialize a new **workspace** folder relative to the project root directory using the [Init](/componentone/api/services/online-dataengine/dotnet-standard-api/C1.DataEngine/C1.DataEngine.Workspace.Init.html) method of the [Workspace](/componentone/api/services/online-dataengine/dotnet-standard-api/C1.DataEngine/C1.DataEngine.Workspace.html) class.

    ```csharp
    // Create and initialize a new workspace folder relative to the project root directory
    Workspace workspace = new Workspace();
    workspace.Init("workspace");
    ```
2. Create a class having a method that returns a collection of the class objects.

    ```csharp
    class Employee
    {
        public int EmployeeID { get; set; }
        public string Department { get; set; }
        public double Salary { get; set; }
        public static List<Employee> GetList()
        {
            List<Employee> employeeList = new List<Employee>();
            string[] departments = { "Production", "Finance", "HR", "R&D", "Marketing" };
            Random random = new Random();
            for (int i = 0; i < 1000; i++)
            {
                employeeList.Add(new Employee()
                {
                    EmployeeID = i + 1,
                    Department = departments[random.Next(0,5)],
                    Salary = Math.Round(random.NextDouble() * 100000, 2),
                });
            }
            return employeeList;
        }
    }
    ```
3. Retrieve the collection of class objects as shown:

    ```csharp
    //Retrieve the collection of objects of the specific class type 
    List<Employee> employeeList = Employee.GetList();
    ```
4. To connect **DataEngine** to the retrieved collection of custom objects, create an instance of the [ObjectConnector](/componentone/api/services/online-dataengine/dotnet-standard-api/C1.DataEngine/C1.DataEngine.ObjectConnector-1.html) class and pass the **Workspace** object and the custom collection initialized above as parameters to its constructor. Use the [GetData](/componentone/api/services/online-dataengine/dotnet-standard-api/C1.DataEngine/C1.DataEngine.ObjectConnector-1.GetData.html) method of the **ObjectConnector** class to create a **DataEngine** base table containing the imported data.

    ```csharp
    //Import data from the custom collection to a DataEngine table
    ObjectConnector<Employee> connector = new ObjectConnector<Employee>(workspace, employeeList);
    connector.GetData("Employees");
    ```

    Once the connection is established, the queries can be defined and executed to fetch the desired data. Refer to [Transform Data](/componentone/docs/services/online-dataengine/workwithdataengine/transformdata) topic for more information.