![]() |
VOOZH | about |
This article illustrates using LINQ to access tables within the Google Cloud Storage via the CData ADO.NET Data Provider for Google Cloud Storage. 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.
You can connect without setting any connection properties for your user credentials. After setting InitiateOAuth to GETANDREFRESH, you are ready to connect.
When you connect, the Google Cloud Storage OAuth endpoint opens in your default browser. Log in and grant permissions, then the OAuth process completes
Service accounts have silent authentication, without user authentication in the browser. You can also use a service account to delegate enterprise-wide access scopes.
You need to create an OAuth application in this flow. See the Help documentation for more information. After setting the following connection properties, you are ready to connect:
The OAuth flow for a service account then completes.
Below is a typical connection string:
ProjectId='project1';InitiateOAuth=GETANDREFRESH;
Using the entity you created, you can now perform select commands. For example:
GoogleCloudStorageEntities context = new GoogleCloudStorageEntities();
var bucketsQuery = from buckets in context.Buckets
select buckets;
foreach (var result in bucketsQuery) {
Console.WriteLine("{0} {1} ", result.Id, result.Name);
}
See "LINQ and Entity Framework" chapter in the help documentation for example queries of the supported LINQ.
Download a free trial of the Google Cloud Storage Data Provider to get started:
Download NowLearn more:
👁 Google Cloud Storage IconRapidly create and deploy powerful .NET applications that integrate with Google Cloud Storage.