views:

43

answers:

1

I am trying out Ado.Net Data Services with this code and I get the following error when trying to access the service : The server encountered an error processing the request. See server logs for more details. Any ideea why?

public class WebDataService : DataService<DemoData>
{

    public static void InitializeService(IDataServiceConfiguration config)
    {
    config.SetEntitySetAccessRule("*", EntitySetRights.All);
    config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
    }
}

public class DemoData
{
    private int[] _Ints = { 4, 2, 1, 2};

    public IQueryable<int> Ints
    {
     get
     {
      return _Ints.AsQueryable<int>();
     }
    }
}
+1  A: 

I would guess that ADO.NET Data Services wants objects - not just integers.

Try, for example:

public class Foo {
    public int Value {get;set;}
}
...
private Foo[] foos = { new Foo { Value = 4}, new Foo { Value = 2},
                       new Foo { Value = 1}, new Foo { Value = 2} };

public IQueryable<Foo> Foos
{
    get { return foos.AsQueryable(); }
}

It may also need data-contract (or other serialization) attributes; I can't remember...

Marc Gravell