![]() |
VOOZH | about |
This article illustrates using LINQ to access tables within the Facebook via the CData ADO.NET Data Provider for Facebook. 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:
FacebookEntities context = new FacebookEntities();
var postsQuery = from posts in context.Posts
select posts;
foreach (var result in postsQuery) {
Console.WriteLine("{0} {1} ", result.Id, result.FromName);
}
See "LINQ and Entity Framework" chapter in the help documentation for example queries of the supported LINQ.
Download a free trial of the Facebook Data Provider to get started:
Download NowLearn more:
👁 Facebook IconConnect any Web, Desktop, or Mobile .NET application with Facebook data including Events, Groups, Pages, Places, Posts and more!