Is it possible to have an OData Action that is not bound to a particular entity or instance, but rather can be invoked upon a collection? Such as...
http://server:port/MyOdataService/Notifications/ClearAll
where Notifications is a ResourceSet, and ClearAll is an action. I liken this to a static method in C#, somewhat.
The obvious workaround is to use a "global" action or an old ServiceOperation, but I would rather not have some of my operations scoped that high up or forced into using tedious names.
At the OData protocol level, it's valid to have an action parameter bound to a collection of entities. For example, if the Notifications
entity set is made up of entities which are of type MyNamespace.Notification
, then the binding parameter of the action will have a type of Collection(MyNamespace.Notification)
.
Within a WCF Data Services action provider, I believe this is possible by just making the ServiceAction.BindingParameter.ParameterType
a CollectionResourceType
(obtained via ResourceType.GetCollectionResourceType(/* notification type */)
). (I haven't tried this out though.)