VOS.VirtEntityFrameworkPGRDatService
Creating an ADO.Net Data Service
An ADO.Net Data Service for the
1.
Open the
2.
Right click on the
3.
The Add New Item dialog will appear.
Choose the ADO.NET Data Service template.
Give it the name Virtuoso.svc and click Add to create the ADO.Net Data Service.
4.
In the newly created Virtuoso.svc.cs Data Service file, add the data source class name of
// C# using System; using System.Web; using System.Collections.Generic; using System.ServiceModel.Web; using System.Linq; using System.Data.Services; namespace SimpleDataService { public class Northwind : DataService<VirtuosoDemoEntities> { public static void InitializeService(IDataServiceConfiguration config) { config.SetEntitySetAccessRule("*", EntitySetRights.All); } } }
5.
To test the Data Service, simply hit Ctrl+F5 within Visual Studio.
This will start the development web server, run the Data Services server inside, and load a Web browser page displaying the list of available tables/entities in the PGR database catalog.
6.
To access a specific entity instance like the Customers table customer ALFKI record, use this convention http://host/vdir/Virtuoso.svc/Customers('ALFKI') .
NOTES
1.
Important - To view Atom (the default format returned by an ADO.NET Data Service) in Internet Explorer, you must first ensure that Feed Reading View is turned off . This can be done on the Content tab of Tools in Internet Options.
2.
If a Data Services entity instance URI page fails to load, you can turn Verbose errors on by adding config.
public static void InitializeService(IDataServiceConfiguration config) { config.UseVerboseErrors = true; config.SetEntitySetAccessRule("*", EntitySetRights.All); }