![]() |
VOOZH | about |
This article illustrates using LINQ to access tables within the JSON via the CData ADO.NET Data Provider for JSON. 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.
See the Getting Started chapter in the data provider documentation to authenticate to your data source: The data provider models JSON APIs as bidirectional database tables and JSON files as read-only views (local files, files stored on popular cloud services, and FTP servers). The major authentication schemes are supported, including HTTP Basic, Digest, NTLM, OAuth, and FTP. See the Getting Started chapter in the data provider documentation for authentication guides.
After setting the and providing any authentication values, set to more closely match the data representation to the structure of your data.
The property is the controlling property over how your data is represented into tables and toggles the following basic configurations.
See the Modeling JSON Data chapter for more information on configuring the relational representation. You will also find the sample data used in the following examples. The data includes entries for people, the cars they own, and various maintenance services performed on those cars.
Below is a typical connection string:
URI=C:/people.json;DataModel=Relational;
Using the entity you created, you can now perform select , update, delete, and insert commands. For example:
JSONEntities context = new JSONEntities();
var peopleQuery = from people in context.people
select people;
foreach (var result in peopleQuery) {
Console.WriteLine("{0} {1} ", result.Id, result.[ personal.name.first ]);
}
See "LINQ and Entity Framework" chapter in the help documentation for example queries of the supported LINQ.
Download a free trial of the JSON Data Provider to get started:
Download NowLearn more:
👁 JSON IconRapidly create and deploy powerful .NET applications that integrate with JSON web services.