views:

301

answers:

1

I'm trying out my ADO.NET Data Service for the first time by having the model create using Entity Framework. I am testing to see if the service works via a client by creating a simple console application. Here is the body of my Main method:


MyEntities context = new MyEntities (new Uri("MyEntitiesDataService.svc", UriKind.Relative));

var query = (from c in context.EmployeeSet select c);

foreach (Employee emp in query)
{ 
     Console.WriteLine("{0}", emp.FirstName);
}


When I reach the first line where the "context" is declared, my debugger jumps to the Reference.cs file where I have the Service Reference within the same project saying "".


/// <summary>
/// Initialize a new MyEntities object.
/// </summary>
public MyEntities(global::System.Uri serviceRoot) : 
     base(serviceRoot)


Can anyone see what I'm doing wrong? Or what do you suggest I do to render by services via a console application? Next step will be Silverlight 3.0.

A: 

Hi ,
The URI string you are passing in to the URI constructor is not a relative path.
Relative Paths start with a '/' character. To get this code to work , change the second parameter of the URI constructor to UriKind.RelativeOrAbsolute .
Hope this helps

Phani Raj