Database Reference
In-Depth Information
5. After the properties are deined in the schema class, a class called context class
will be created so that an application is able to instantiate its own Table storage
by using the deinition speciied in the schema class. To be able to use the services
provided by WCF Data Services, the context class is so constructed that it will be
derived from the class TableServiceContext, which itself is derived from another
WCF Data Service class DataServiceContext. he TableServiceContext class can
be used to manage the credentials and retry policy. In a context class, the public
property of the type IQueryable < SchemaClass > is used to expose a table speciied
by the schema class to an application. To create the context class, right-click the
StudentClub_Info project, and select Add | New item . In the Add New Item dia-
log, select the Code category and then select the Class template. Change the class
name to StudentClubContext.cs and click Add . Add the following code in the
class StduentClubContext.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.StorageClient;
namespace StudentClub_Info
{
public class StudentClubContext : Microsoft.WindowsAzure.
StorageClient.TableServiceContext
{
//Default constructor used to initialize the base class with
//storage account access information.
public StudentClubContext(string baseAddress,
Microsoft.WindowsAzure.StorageCredentials credentials)
: base(baseAddress, credentials)
{}
//Define the property that returns the StudentClubEntry table.
public IQueryable < StudentClubEntry1 > StudentClubEntry1
{
get
{
return this.
CreateQuery < StudentClubEntry1 > ("StudentClubEntry1");
}
}
}
}
6. After the table is returned in the context class, you need to create a data source class
that implements data source objects to provide the data to the controls on the appli-
cation's web page and to allow the front-end users to interact with the Table storage.
To do so, right click the StudentClub_Info project and select Add | New item . In
 
Search WWH ::




Custom Search