<docbook><section><title>VirtEntityFrameworkOracleDatService</title><bridgehead class="http://www.w3.org/1999/xhtml:h3">Creating an ADO.Net Data Service</bridgehead>
<para>An ADO.Net Data Service for the Oracle tables can be created using the Entity Data Model created in the <ulink url="VirtOracleEDM">Creating EDM in Visual Studio 2008</ulink> section.</para><para>1.
 Open the <emphasis>VirtuosoDataService</emphasis> project created in the <ulink url="VirtOracleEDM">Creating EDM in Visual Studio 2008</ulink> section.</para><para>2.
 Right click on the <emphasis>VirtuosoDataService</emphasis> project name of the <emphasis>Solution Explorer</emphasis> pane, then select the <emphasis>Add</emphasis> -&gt; <emphasis>New Item</emphasis> menu options.
<figure><graphic fileref="VirtEntityFrameworkOracleDatService/VirtAdoNetDataServices_4.png" /></figure></para><para>3.
 The <emphasis>Add New Item</emphasis> dialog will appear.
 Choose the <emphasis>ADO.NET Data Service</emphasis> template.
 Give it the name <emphasis>Virtuoso.svc</emphasis> and click <emphasis>Add</emphasis> to create the ADO.Net Data Service.
<figure><graphic fileref="VirtEntityFrameworkOracleDatService/VirtAdoNetDataServices_15.png" /></figure></para><para>4.
 In the newly created <emphasis>Virtuoso.svc.cs</emphasis> Data Service file, add the data source class name of <emphasis>VirtuosoEntities</emphasis> (note this is the name set in the Creating EDM in Visual Studio 2008 section) as the <emphasis>DataService</emphasis> name.
 Then, enable access to the Data Service by adding the entry <emphasis>config.SetEntitySetAccessRule(&quot;*&quot;, EntitySetRights.All);</emphasis> in the <emphasis>InitializeService</emphasis> method.</para><programlisting>
// 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&lt;VirtuosoDemoEntities&gt;
    {
        public static void InitializeService(IDataServiceConfiguration  config)
        {
            config.SetEntitySetAccessRule(&quot;*&quot;, EntitySetRights.All);
        }
    }
}

</programlisting><para> <figure><graphic fileref="VirtEntityFrameworkOracleDatService/VirtAdoNetDataServices_16.png" /></figure></para><para>5.
 To test the Data Service, simply hit <emphasis>Ctrl+F5</emphasis> 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 HR database catalog.
<figure><graphic fileref="VirtEntityFrameworkOracleDatService/VirtEntityFrameworkOracleDatService1.png" /></figure></para><para>6.
 To access a specific entity instance like the <emphasis>EMPLOYEES</emphasis> table employee number <emphasis>100</emphasis> record, use this convention <emphasis><ulink url="http://host/vdir/Virtuoso.svc/EMPLOYEES(100)">http://host/vdir/Virtuoso.svc/EMPLOYEES(100)</ulink> </emphasis> . <figure><graphic fileref="VirtEntityFrameworkOracleDatService/VirtEntityFrameworkOracleDatService2.png" /></figure></para><bridgehead class="http://www.w3.org/1999/xhtml:h3">NOTES</bridgehead>
<para>1.
 <emphasis>Important</emphasis> - To view <emphasis>Atom</emphasis> (the default format returned by an ADO.NET Data Service) in Internet Explorer, you must first ensure that <emphasis>Feed Reading View</emphasis> is turned <emphasis>off</emphasis> . This can be done on the <emphasis>Content tab</emphasis> of <emphasis>Tools<emphasis> in <emphasis>Internet Options</emphasis>.</emphasis></emphasis></para><para>2.
 If a Data Services entity instance URI page fails to load, you can turn <emphasis>Verbose</emphasis> errors on by adding <emphasis>config.UseVerboseErrors <computeroutput>=</computeroutput> true;</emphasis> in the <emphasis>virtuoso.svc.cs InitializeService </emphasis> method.
 This allows you to obtain more detailed information from the server as to why the page failed to load:</para><programlisting>
public static void InitializeService(IDataServiceConfiguration config)

{

config.UseVerboseErrors = true;

config.SetEntitySetAccessRule(&quot;*&quot;, EntitySetRights.All);

}

</programlisting></section></docbook>