![]() |
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 Paylocity can be used with standard ADO.NET interfaces, such as LINQ and Entity Framework, to interact with live Paylocity 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 Paylocity using standard SQL queries.
CData ADO.NET Providers allow users to access Paylocity just like they would access SQL Server, using simple SQL queries.
Install the Paylocity ADO.NET Data Provider from the CData website or from NuGet. Search NuGet for "Paylocity ADO.NET Data Provider."
๐ Install ADO.NET Paylocity Provider from NuGet.Start by creating a Blazor project that references the CData ADO.NET Provider for Paylocity
Set the following to establish a connection to Paylocity:
This property is required for executing Insert and Update statements, and it is not required if the feature is disabled.
Paylocity will decrypt the AES key using RSA decryption.
It is an optional property if the IV value not provided, The driver will generate a key internally.
You must use OAuth to authenticate with Paylocity. OAuth requires the authenticating user to interact with Paylocity using the browser. For more information, refer to the OAuth section in the Help documentation.
The Pay Entry API is completely separate from the rest of the Paylocity API. It uses a separate Client ID and Secret, and must be explicitly requested from Paylocity for access to be granted for an account. The Pay Entry API allows you to automatically submit payroll information for individual employees, and little else. Due to the extremely limited nature of what is offered by the Pay Entry API, we have elected not to give it a separate schema, but it may be enabled via the UsePayEntryAPI connection property.
Please be aware that when setting UsePayEntryAPI to true, you may only use the CreatePayEntryImportBatch & MergePayEntryImportBatchgtable stored procedures, the InputTimeEntry table, and the OAuth stored procedures. Attempts to use other features of the product will result in an error. You must also store your OAuthAccessToken separately, which often means setting a different OAuthSettingsLocation when using this connection property.
For example: OAuthClientID=YourClientId;OAuthClientSecret=YourClientSecret;RSAPublicKey=YourRSAPubKey;Key=YourKey;IV=YourIV;InitiateOAuth=GETANDREFRESH;
@page "/"
@using System.Data;
@using System.Data.CData.Paylocity;
<h1>Hello, world!</h1>
Welcome to your Data app.
<div class="row">
<div class="col-12">
@using (PaylocityConnection connection = new PaylocityConnection(
"OAuthClientID=YourClientId;OAuthClientSecret=YourClientSecret;RSAPublicKey=YourRSAPubKey;Key=YourKey;IV=YourIV;InitiateOAuth=GETANDREFRESH;"))
{
var sql = "SELECT FirstName, LastName FROM Employee WHERE EmployeeId = '1234'";
var results = new DataTable();
PaylocityDataAdapter dataAdapter = new PaylocityDataAdapter(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 Paylocity-connected Blazor app, capable of working with live Paylocity data just like you would work with a SQL Server instance. Download a free, 30-day trial and start working with live Paylocity data in your Blazor apps today.
Download a free trial of the Paylocity Data Provider to get started:
Download NowLearn more:
๐ Paylocity IconRapidly create and deploy powerful .NET applications that integrate with Paylocity.