locked
How to expose a custom method with OData RRS feed

  • Question

  • I need to expose custom methods (not directly related to the database model) within my OData service.

     

    Example:

            public static void InitializeService(DataServiceConfiguration config)
            {
                // TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
                // Examples:
                config.SetEntitySetAccessRule("*", EntitySetRights.All);
                config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
                config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
            }

            [WebGet]
            public bool GetUpdatePrivilege(string table, Guid entityKey)
            {
                bool RetVal = false;
                // do some work here...
                return RetVal;
            }

    The problem is I can never "see" this method, nor call it (I get a "resource not found" error).

     

    How can I accomplish this?

     

    Many Thanks!


    Michael A Strasser
    Tuesday, January 10, 2012 5:47 PM

Answers

All replies