# Data Engine SSAS Service

## Content

Complete the following steps to add data to Data Engine using SSAS service:

### Step1: Create a new WebAPI application

1. In Visual Studio, select **File \| New \| Project** to create a new Web API Service Project.
2. Under installed templates, select **C1 \| Visual C\# \| Web \| C1 Web API Application** to create a new C1 Web API Service application.
3. Set a **Name** and **Location** for your application, and then Click **OK.**
4. In the **ComponentOne ASP.NET Web API Application Wizard**, select **Data engine services** option.
5. Once you have selected the **Services** from the wizard, click **OK** to create a new **C1 Web API Service application**. In this new project, ComponentOne template adds the references C1.Web.Api.dll, C1.DataEngine.dll, and C1.WebApi.DataEngine.dll.

### Step2: Configure Startup.cs file

1. From the Solution Explorer, select and open **Startup.cs** file. Here we are setting up the SSAS service URL to access the cube data.
2. In the **Startup.cs** file, add the following code inside the Startup class. In this step we are configuring the SSAS service URL for the application.
<br>
    The following table describes the SSAS connection string.

    | **Property** | **Description** | **Example** |
    | -------- | ----------- | ------- |
    | Data Source | Specifies the server instance. This property is required for all connections. Valid values include the network name or IP address of the server, local or localhost for local connections, or the name of a local cube (.cub) file. | Data source=AW-SRV01.corp.Adventure-Works.com |
    | Initial Catalog or Catalog | Specifies the name of the Analysis Services database to connect to. The database must be deployed on Analysis Services, and you must have permission to connect to it. | Initial catalog=AdventureWorks2016 |
    | Provider | Valid values include MSOLAP.\<version>, where \<version> is either 4, 5, 6 or 7. | Provider=MSOLAP.7 is used for connections that require the SQL Server 2016 |

    ```csharp
    public class Startup
        {
            private readonly HttpConfiguration config = GlobalConfiguration.Configuration;
            public void Configuration(IAppBuilder app)
            {                      
                   app.UseDataEngineProviders()     
                   .AddCube("cube", @"Data Source=http://ssrs.componentone.com/OLAP/msmdpump.dll;Provider=msolap;Initial Catalog=AdventureWorksDW2012Multidimensional", "Adventure Works");
                // CORS supports
               app.UseCors(CorsOptions.AllowAll);
                // Web Api
                RegisterRoutes(config);
                app.UseWebApi(config);
            }
    ```

### Step 3: Build and Run the Project

1. Click **Build \| Build Solution** to build the project.
2. Press **F5** to run the project.

    > Append the URL path (for example: **http://localhost:1234/api/dataengine/cube**) in the address bar of the browser to check if the service is hosted successfully. Use the service URL for bind service call when configuring the OLAP PivotEngine in your MVC or Wijmo application.