![]() |
VOOZH | about |
Blazor is a framework for developing modern, client-side web UIs using .NET technology. Instead of coding in JavaScript, developers can use the familiar C# language and .NET libraries to build app UIs.
The CData ADO.NET Provider for SQL Analysis Services can be used with standard ADO.NET interfaces, such as LINQ and Entity Framework, to interact with live SQL Analysis Services data. Since Blazor supports .NET Core, developers can use CData ADO.NET Providers in Blazor apps. In this article, we will guide you to build a simple Blazor app that talks to SQL Analysis Services using standard SQL queries.
CData ADO.NET Providers allow users to access SQL Analysis Services just like they would access SQL Server, using simple SQL queries.
Install the SQL Analysis Services ADO.NET Data Provider from the CData website or from NuGet. Search NuGet for "SQL Analysis Services ADO.NET Data Provider."
๐ Install ADO.NET SQL Analysis Services Provider from NuGet.Start by creating a Blazor project that references the CData ADO.NET Provider for SQL Analysis Services
To connect, provide authentication and set the Url property to a valid SQL Server Analysis Services endpoint. You can connect to SQL Server Analysis Services instances hosted over HTTP with XMLA access. See the Microsoft documentation to configure HTTP access to SQL Server Analysis Services.
To secure connections and authenticate, set the corresponding connection properties, below. The data provider supports the major authentication schemes, including HTTP and Windows, as well as SSL/TLS.
Set AuthScheme to "Basic" or "Digest" and set User and Password. Specify other authentication values in CustomHeaders.
Set the Windows User and Password and set AuthScheme to "NTLM".
To authenticate with Kerberos, set AuthScheme to NEGOTIATE. To use Kerberos delegation, set AuthScheme to KERBEROSDELEGATION. If needed, provide the User, Password, and KerberosSPN. By default, the data provider attempts to communicate with the SPN at the specified Url.
By default, the data provider attempts to negotiate SSL/TLS by checking the server's certificate against the system's trusted certificate store. To specify another certificate, see the SSLServerCert property for the available formats.
You can then access any cube as a relational table: When you connect the data provider retrieves SSAS metadata and dynamically updates the table schemas. Instead of retrieving metadata every connection, you can set the CacheLocation property to automatically cache to a simple file-based store.
See the Getting Started section of the CData documentation, under Retrieving Analysis Services Data, to execute SQL-92 queries to the cubes.
For example: User=myuseraccount;Password=mypassword;URL=http://localhost/OLAP/msmdpump.dll;
@page "/"
@using System.Data;
@using System.Data.CData.SSAS;
<h1>Hello, world!</h1>
Welcome to your Data app.
<div class="row">
<div class="col-12">
@using (SSASConnection connection = new SSASConnection(
"User=myuseraccount;Password=mypassword;URL=http://localhost/OLAP/msmdpump.dll;"))
{
var sql = "SELECT Fiscal_Year, Sales_Amount FROM Adventure_Works";
var results = new DataTable();
SSASDataAdapter dataAdapter = new SSASDataAdapter(sql, connection);
dataAdapter.Fill(results);
<table class="table table-bordered">
<thead class="thead-light">
<tr>
@foreach (DataColumn item in results.Rows[0].Table.Columns)
{
<th scope="col">@item.ColumnName</th>
}
</tr>
</thead>
<tbody>
@foreach (DataRow row in results.Rows)
{
<tr>
@foreach (var column in row.ItemArray)
{
<td>@column.ToString()</td>
}
</tr>
}
</tbody>
</table>
}
</div>
</div>
At this point, you have a SQL Analysis Services-connected Blazor app, capable of working with live SQL Analysis Services data just like you would work with a SQL Server instance. Download a free, 30-day trial and start working with live SQL Analysis Services data in your Blazor apps today.
Download a free trial of the SQL Analysis Services Data Provider to get started:
Download NowLearn more:
๐ SQL Server Analysis Services IconRapidly create and deploy powerful .NET applications that integrate with SQL Analysis Services.