Custom Logic and Proxy Classes in ADO.NET Data Services

Posted by rasx on Stack Overflow See other posts from Stack Overflow or by rasx
Published on 2010-04-29T21:50:52Z Indexed on 2010/04/29 22:07 UTC
Read the original article Hit count: 389

Filed under:
|

I've just read "Injecting Custom Logic in ADO.NET Data Services" and my next question is, How do you get your [WebGet] method to show up in the client-side proxy classes? Sure, I can call this directly (RESTfully) with, say, WebClient but I thought the strong typing features in ADO.NET Data Services would "hide" this from me auto-magically.

So here we have:

public class MyService : DataService<MyDataSource>
{
    // This method is called only once to initialize service-wide policies.
    public static void InitializeService(IDataServiceConfiguration config)
    {
        config.SetEntitySetAccessRule("Customers", EntitySetRights.AllRead);
        config.SetServiceOperationAccessRule("CustomersInCity", ServiceOperationRights.All);
    }

    [WebGet]
    public IQueryable<MyDataSource.Customers> CustomersInCity(string city)
    {
        return from c in this.CurrentDataSource.Customers
               where c.City == city
               select c;
    } 

}

How can I get CustomersInCity() to show up in my client-side class defintions?

© Stack Overflow or respective owner

Related posts about OData

Related posts about ADO.NET