<docbook><section><title>VirtEntityFrameworkOODBCDatService</title><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3">Creating an ADO.Net Data Service for ODBC-Compliant Databases</bridgehead>
<para>An ADO.Net Data Service for the Microsoft Access Northwind tables can be created using the Entity Data Model created in the <emphasis><ulink url="VirtOODBCEDM">Creating EDM in Visual Studio 2008</ulink></emphasis> section.</para>
<orderedlist spacing="compact"><listitem>Open the <emphasis>VirtuosoDataService</emphasis> project created in the <emphasis><ulink url="VirtOODBCEDM">Creating EDM in Visual Studio 2008</ulink></emphasis> section. </listitem>
<listitem>Right click on the <emphasis>VirtuosoDataService</emphasis> project name in the <emphasis>Solution Explorer</emphasis> pane.
 Then, select the <emphasis>Add</emphasis> -&gt; <emphasis>New Item</emphasis> menu options.
<figure><graphic fileref="VirtEntityFrameworkOODBCDatService/VirtAdoNetDataServices_4.png" /></figure> </listitem>
<listitem>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="VirtEntityFrameworkOODBCDatService/VirtAdoNetDataServices_15.png" /></figure> </listitem>
<listitem>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 <emphasis><ulink url="VirtOODBCEDM">Creating EDM in Visual Studio 2008</ulink></emphasis> section) as the <emphasis>DataService</emphasis> name.
 Enable access to the Data Service by adding the entry <emphasis>config.SetEntitySetAccessRule(&quot;*&quot;, EntitySetRights.All);</emphasis> to the <emphasis>InitializeService</emphasis> method.
<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><figure><graphic fileref="VirtEntityFrameworkOODBCDatService/VirtAdoNetDataServices_16.png" /></figure> </listitem>
<listitem>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 for the Microsoft Access Northwind database catalog.
<figure><graphic fileref="VirtEntityFrameworkOODBCDatService/VirtEntityFrameworkOODBCDatService1.png" /></figure> </listitem>
<listitem>To access a specific entity instance like the Customers table ALFKI record, use this convention: <emphasis>http://host/vdir/Virtuoso.svc/Customers(&#39;ALFKI&#39;)</emphasis> . <figure><graphic fileref="VirtEntityFrameworkOODBCDatService/VirtEntityFrameworkOODBCDatService2.png" /></figure></listitem>
</orderedlist><bridgehead class="http://www.w3.org/1999/xhtml:h3">NOTES</bridgehead>
 <orderedlist spacing="compact"><listitem><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></listitem>
<listitem>If a Data Services entity instance URI page fails to load, you can turn <emphasis>Verbose</emphasis> errors on by adding <emphasis>config.UseVerboseErrors = true;</emphasis> in the <emphasis>virtuoso.svc.cs InitializeService</emphasis> method to obtain more detailed information from the server as to why the page failed to load: <programlisting>public static void InitializeService(IDataServiceConfiguration config)
{
    config.UseVerboseErrors = true;
    config.SetEntitySetAccessRule(&quot;*&quot;, EntitySetRights.All);
}
</programlisting></listitem>
</orderedlist><para><ulink url="CategoryDocumentation">CategoryDocumentation</ulink> <ulink url="CategoryVirtuoso">CategoryVirtuoso</ulink> <ulink url="CategoryEntityFramework">CategoryEntityFramework</ulink> <ulink url="CategoryDotNET">CategoryDotNET</ulink> <ulink url="CategoryODBC">CategoryODBC</ulink> <ulink url="CategoryODBCODBCBridge">CategoryODBCODBCBridge</ulink> </para>
</section></docbook>