![]() |
VOOZH | about |
This article illustrates using LINQ to access tables within the Facebook Ads via the CData ADO.NET Data Provider for Facebook Ads. 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.
Most tables require user authentication as well as application authentication. Facebook uses the OAuth authentication standard. To authenticate to Facebook, you can use the embedded OAuthClientId, OAuthClientSecret, and CallbackURL or you can obtain your own by registering an app with Facebook.
See the Getting Started chapter of the help documentation for a guide to using OAuth.
Below is a typical connection string:
InitiateOAuth=GETANDREFRESH;
Using the entity you created, you can now perform select , update, delete, and insert commands. For example:
FacebookAdsEntities context = new FacebookAdsEntities();
var adaccountsQuery = from adaccounts in context.AdAccounts
select adaccounts;
foreach (var result in adaccountsQuery) {
Console.WriteLine("{0} {1} ", result.Id, result.AccountId);
}
See "LINQ and Entity Framework" chapter in the help documentation for example queries of the supported LINQ.
Download a free trial of the Facebook Ads Data Provider to get started:
Download NowLearn more:
👁 Facebook Ads IconRapidly create and deploy powerful .NET applications that integrate with Facebook Ads.