![]() |
VOOZH | about |
Microsoft Entity Framework serves as an object-relational mapping framework for working with data represented as objects. Although Visual Studio offers the ADO.NET Entity Data Model wizard to automatically generate the Entity Model, this model-first approach may present challenges when your data source undergoes changes or when you require greater control over entity operations. In this article, we will delve into the code-first approach for accessing Workday data through the CData ADO.NET Provider, providing you with more flexibility and control.
CData provides the easiest way to access and integrate live data from Workday. Customers use CData connectivity to:
Users frequently integrate Workday with analytics tools such as Tableau, Power BI, and Excel, and leverage our tools to replicate Workday data to databases or data warehouses. Access is secured at the user level, based on the authenticated user's identity and role.
For more information on configuring Workday to work with CData, refer to our Knowledge Base articles: Comprehensive Workday Connectivity through Workday WQL and Reports-as-a-Service & Workday + CData: Connection & Integration Best Practices.
Modify the App.config file in the project to add a reference to the Workday Entity Framework 6 assembly and the connection string.
To connect to Workday, users need to find the Tenant and BaseURL and then select their API type.
To obtain the BaseURL and Tenant properties, log into Workday and search for "View API Clients." On this screen, you'll find the Workday REST API Endpoint, a URL that includes both the BaseURL and Tenant.
The format of the REST API Endpoint is: https://domain.com/subdirectories/mycompany, where:
The value you use for the ConnectionType property determines which Workday API you use. See our Community Article for more information on Workday connectivity options and best practices.
| API | ConnectionType Value |
|---|---|
| WQL | WQL |
| Reports as a Service | Reports |
| REST | REST |
| SOAP | SOAP |
Your method of authentication depends on which API you are using.
See the Help documentation for more information on configuring OAuth with Workday.
<configuration> ... <connectionStrings> <add name="WorkdayContext" connectionString="Offline=False;User=myuser;Password=mypassword;Tenant=mycompany_gm1;BaseURL=https://wd3-impl-services1.workday.com;ConnectionType=WQL;InitiateOAuth=GETANDREFRESH;" providerName="System.Data.CData.Workday" /> </connectionStrings> <entityFramework> <providers> ... <provider invariantName="System.Data.CData.Workday" type="System.Data.CData.Workday.WorkdayProviderServices, System.Data.CData.Workday.Entities.EF6" /> </providers> <entityFramework> </configuration> </code>
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Data.Entity.ModelConfiguration.Conventions;
class WorkdayContext : DbContext {
public WorkdayContext() { }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
// To remove the requests to the Migration History table
Database.SetInitializer<WorkdayContext>(null);
// To remove the plural names
modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
}
}
using System.Data.Entity.ModelConfiguration;
using System.ComponentModel.DataAnnotations.Schema;
[System.ComponentModel.DataAnnotations.Schema.Table("Workers")]
public class Workers {
[System.ComponentModel.DataAnnotations.Key]
public System.String Worker_Reference_WID { get; set; }
public System.String Legal_Name_Last_Name { get; set; }
}
public DbSet<Workers> Workers { set; get; }
WorkdayContext context = new WorkdayContext(); context.Configuration.UseDatabaseNullSemantics = true; var query = from line in context.Workers select line;
Download a free trial of the Workday Data Provider to get started:
Download NowLearn more:
👁 Workday IconRapidly create and deploy powerful .NET applications that integrate with Workday.