RIA Service/oData ... "Requests that attempt to access a single element using key values from a resu

Posted by user327911 on Stack Overflow See other posts from Stack Overflow or by user327911
Published on 2010-04-28T14:50:02Z Indexed on 2010/04/28 14:53 UTC
Read the original article Hit count: 197

Filed under:
|
|

I've recently started working up a sample project to play with an oData feed coming from a RIA service. I am able to view the feed and the metadata via any web browser, however, if I try to perform certain query operations on the feed I receive "unsupported" exceptions.

Sample oData feed: ProductSet http://localhost:50880/Services/Rebirth-Web-Services-ProductService.svc/OData/ProductSet/ 2010-04-28T14:02:10Z http://localhost:50880/Services/Rebirth-Web-Services-ProductService.svc/OData/ProductSet(guid'b0a2b170-c6df-441f-ae2a-74dd19901128') 2010-04-28T14:02:10Z b0a2b170-c6df-441f-ae2a-74dd19901128 Product 0 Type 1 Active

Sample web.config entry:

Sample service: [EnableClientAccess()] public class ProductService : DomainService {
[Query(IsDefault = true)]
public IQueryable GetProducts() { IList products = new List();

        for (int i = 0; i < 90; i++) {                
            Product product = new Product {
                Id = Guid.NewGuid(),
                Name = "Product " + i.ToString(),
                ProductType = i < 30 ? "Type 1" : ((i > 30 && i < 60) ? "Type 2" : "Type 3"),
                Status = i % 2 == 0 ? "Active" : "NotActive"
            };

            products.Add(product);
        }

        return products.AsQueryable();
    }
}

If I provide the url "http://localhost:50880/Services/Rebirth-Web-Services-ProductService.svc/OData/ProductSet(guid'b0a2b170-c6df-441f-ae2a-74dd19901128')" to my web browser I receive the following xml:

Requests that attempt to access a single element using key values from a result set are not supported.

I'm new to RIA and oData. Could this be something as simple as my web browsers not supporting this type of querying on the result set or something else?

Thanks ahead!

Corey

© Stack Overflow or respective owner

Related posts about OData

Related posts about wcf