Database Reference
In-Depth Information
Figure 6-10. Adding a WCF Data Service to the Solution
When the ADO.NET Data Service is added to your project, the associated .cs file will automatically
be displayed in the IDE. As you can see the ADO.NET Data Service template has generated for you the
beginnings of your data service.
Connecting the Service to the Model
Now you need to wire up your data service to your data model so that the service knows where to get
its data. You know where to do this because as you can see in the code it tells you where to enter that
information. Thus, change the line:
public class TechBioDataService : DataService< /* TODO: put your data source
class name here */ >
To:
public class TechBioDataService : DataService< TechBioEntities >
Wiring up your data service to the model is as simple as that. Believe it or not, you're ready to test
your service. However, let's finish what you need to do on this page. By default, the WCF Data Service is
secured. The WCF Data Service needs to be told explicitly which data you want to see. The instructions
in the code tell you this, as you can see in code in the InitializeService method. Some examples are even
provided in the comments to help you out.
For your example, you don't want to restrict anything so you really want to unlock all the entities
and explicitly define access rights to the entity sets. You do this by adding the code below to the
Search WWH ::




Custom Search