Creating An Entity Model
Step 1: Before We Begin
Launch Visual Studio and open your RSSBus ADO.NET Provider for Google Spreadsheets project. If you do not yet have a project, go ahead and create one now.
Step 2: Add a New Item To Your Project
In the Visual Studio Solution Explorer, right-click on your project, select "Add", and then select "New Item..."
Step 3: Create an ADO.NET Entity Data Model
In the "Add New Item" dialog that pops up, select "ADO.NET Entity Data Model" and name it an appropriate title like "GoogleSheetsEntityDataModel.edmx".
Step 4: Follow the Entity Data Model Wizard
Visual Studio now presents you with a wizard. Select "Generate from database" in the first pane. In the second wizard pane, you will need to select a data connection. Go ahead and select the data provider connection you intend to use with your project. Alternatively, you can create a new connection in this pane.The wizard also asks whether to include sensitive data (meaning passwords) in the connection string. Select the option appropriate to your needs. Note that opting to exclude sensitive data means password fields will not be copied to the generated config file with the rest of the connection string properties.
Note: this step may take several minutes as Visual Studio retrieves table schemas from Google SpreadSheets. To learn about optimizing this process, see Caching Metadata.
After Visual Studio retrieves the necessary information from the live data source, it presents a listing of database objects for you to choose to include in your project.
Step 5: Perform LINQ Commands in Your Code
You are now ready to start using LINQ in your code. Be sure to declare using System.Linq in your file.GoogleSheetsEntities ents = new GoogleSheetsEntities();
var MySpreadsheetsQuery = from MySpreadsheets in ents.MySpreadsheets
orderby MySpreadsheets.Column1
select MySpreadsheets;
foreach(var result in MySpreadsheetsQuery) {
Console.WriteLine("{0} {1} ", result.Id, result.Column1);
}