Attributes | Values |
---|
type
| |
Date Created
| |
Date Modified
| |
label
| - VirtEntityFrameworkFirebirdDatService
|
maker
| |
Title
| - VirtEntityFrameworkFirebirdDatService
|
isDescribedUsing
| |
has creator
| |
attachment
| |
content
| - %META:TOPICPARENT{name="VirtFirebirdEntityFrameworkUsage"}%
---+++Creating an ADO.NET Data Service
An ADO.NET Data Service for the Firebird tables can be created using the Entity Data Model created in the [[VirtFirebirdEDM][Creating EDM in Visual Studio 2008]] section.
1 Open the <b>employee</b> project created in the [[VirtFirebirdEDM][Creating EDM in Visual Studio 2008]] section.%BR%%BR%
1 Right click on the <b>employee</b> project name in the <b>Solution Explorer</b> pane, then select the <b>Add</b> -> <b>New Item</b> menu options.
%BR%%BR%<img src="%ATTACHURLPATH%/VirtAdoNetFirebirdDataService_01.png" style="wikiautogen"/>%BR%%BR%
1 The <b>Add New Item</b> dialog will appear. Choose the <b>ADO.NET Data Service</b> template. Give it the name <b>WebDataService1.svc</b>, and click <b>Add</b> to create the ADO.NET Data Service.
%BR%%BR%<img src="%ATTACHURLPATH%/VirtAdoNetFirebirdDataService_02.png" style="wikiautogen"/>%BR%%BR%
1 In the newly created <b>WebDataService1.svc.cs</b> Data Service file, add the data source class name of <b>employeeEntities</b> (note this is the name set in the Creating EDM in Visual Studio 2008 section) as the <b><nop>DataService</b> name. Enable access to the Data Service by adding the entry <b>config.SetEntitySetAccessRule("*", EntitySetRights.All);</b> in the <b><nop>InitializeService</b> method.
<verbatim>
// 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<employeeEntities>
{
public static void InitializeService(IDataServiceConfiguration config)
{
config.SetEntitySetAccessRule("*", EntitySetRights.All);
}
}
}
</verbatim>
%BR%%BR%<img src="%ATTACHURLPATH%/VirtAdoNetFirebirdDataService_03.png" style="wikiautogen"/>%BR%%BR%
1 To test the Data Service, simply hit <b>Ctrl+F5</b> 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 tables/entities for the stores_demo database catalog.
%BR%%BR%<img src="%ATTACHURLPATH%/VirtAdoNetFirebirdDataService_04.png" style="wikiautogen"/>%BR%%BR%
1 To access a specific entity instance like the <b>EMPLOYEE</b> table employee number <b>2</b> record, use this convention <b>http://host/vdir/WebDataService1.svc/EMPLOYEE(2) </b> .
%BR%%BR%<img src="%ATTACHURLPATH%/VirtAdoNetFirebirdDataService_05.png" style="wikiautogen"/>%BR%%BR%
---+++NOTES
1 <b>Important</b> - To view <b>Atom</b> (the default format returned by an ADO.NET Data Service) in Internet Explorer, you must first ensure that <b>Feed Reading View</b> is turned <b>off</b>. This can be done on the <b>Content tab</b> of <b>Tools<b> in <b>Internet Options</b>.%BR%%BR%
1 If a Data Services entity instance URI page fails to load you can turn <b>Verbose</b> errors on by adding <b><code>config.UseVerboseErrors = true;</code></b> in the <b><code>virtuoso.svc.cs</code> <nop>InitializeService </b> method. This enables you to obtain more detailed information from the server as to why the page failed to load:
<verbatim>
public static void InitializeService(IDataServiceConfiguration config)
{
config.UseVerboseErrors = true;
config.SetEntitySetAccessRule("*", EntitySetRights.All);
}
</verbatim>
|
id
| - 41eff177ede801094d993006a087e4e8
|
link
| |
has container
| |
http://rdfs.org/si...ices#has_services
| |
atom:title
| - VirtEntityFrameworkFirebirdDatService
|
links to
| |
atom:source
| |
atom:author
| |
atom:published
| |
atom:updated
| |
topic
| |
is made
of | |
is container of
of | |
is link
of | |
is http://rdfs.org/si...vices#services_of
of | |
is links to
of | |
is creator of
of | |
is atom:entry
of | |
is atom:contains
of | |