![]() |
VOOZH | about |
This article illustrates using LINQ to access tables within the Bitbucket via the CData ADO.NET Data Provider for Bitbucket. To achieve this, we will use LINQ to Entity Framework, which facilitates the generation of connections and can be seamlessly employed with any CData ADO.NET Data Providers to access data through LINQ.
See the help documentation for a guide to setting up an EF 6 project to use the provider.
Enter your data source connection information.
For most queries, you must set the Workspace. The only exception to this is the Workspaces table, which does not require this property to be set, as querying it provides a list of workspace slugs that can be used to set Workspace. To query this table, you must set Schema to 'Information' and execute the query SELECT * FROM Workspaces>.
Setting Schema to 'Information' displays general information. To connect to Bitbucket, set these parameters:
Bitbucket supports OAuth authentication only. To enable this authentication from all OAuth flows, you must create a custom OAuth application, and set AuthScheme to OAuth.
Be sure to review the Help documentation for the required connection properties for you specific authentication needs (desktop applications, web applications, and headless machines).
From your Bitbucket account:
Below is a typical connection string:
Workspace=myworkspaceslug;Schema=Information;InitiateOAuth=GETANDREFRESH;
Using the entity you created, you can now perform select , update, delete, and insert commands. For example:
BitbucketEntities context = new BitbucketEntities();
var issuesQuery = from issues in context.Issues
select issues;
foreach (var result in issuesQuery) {
Console.WriteLine("{0} {1} ", result.Id, result.Title);
}
See "LINQ and Entity Framework" chapter in the help documentation for example queries of the supported LINQ.
Download a free trial of the Bitbucket Data Provider to get started:
Download NowLearn more:
👁 Bitbucket IconRapidly create and deploy powerful .NET applications that integrate with Bitbucket.