What I am trying to accomplish is to break up the overall REST service into a set of REST services (each of which expose a subset of the overall REST service functionality). For example, I may want to expose all of the GET methods to some clients yet expose
some of the PUT methods to other clients. I may also not want other clients to know about certain tables in my DB so I may only want specific clients to GET or PUT from specific tables (i.e. specific REST methods). Does this make sense? So in order to do this,
I have created my own well-defined REST service that wraps your generated REST service functionality. That way I can control what each sub-service is capable of providing. I have tried to provide a simple example below. In this example, I have a DB that stores
User information, Location information,
Employment information, etc... However, I only want to expose the ability to request the current
User list via REST.
The main User service implementation is shown below...
[assembly: ContractNamespace("", ClrNamespace = "MyCompany.MyProject.REST")]
[ServiceBehavior(IncludeExceptionDetailInFaults = true, InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Single)]
public class MyUserService : IMyUserService
// The full REST service provided via nHydrate...
private readonly Rest _RestService;
_RestService = new Rest();
#region IMyUserService Members
The User service interface is shown below...
public interface IMyUserService
#region User Select All
[WebHelp(Comment = "Returns a list of User objects to the user.")]
[WebGet(UriTemplate = "UserList/?format=xml", ResponseFormat = WebMessageFormat.Xml)]
The use of the interface is not required but shown here for demonstration purposes only.