I had some good results with implementing Rest Web Services with ServiceStack Framework, but I noticed somethings in samples I would like some more information.
-
I have currently created a Service based on
IServiceinterface. What is the differences with usingIRestServiceBase? When should I use either one or the other (my web service has routes so it’s REST already right)? -
What is the difference between these 2 syntaxes?
MyEvent : RestServiceBase <Event> public override object OnGet(...)and
MyEvent : IService public object Get(...)The one I use with my
IServiceis the second version, is version one being more ‘REST’ than the other? I tested both and did same results. -
I have not used attributes
[DataMember]or[DataContract]the way it’s done on WCF, in which situation do I have to use this? (to speak the truth I can really pass on adding this useless information). -
In Movie sample, what are
Interfaces : IRestGetService? What is their purpose when my class already hasIService?
The newer style api uses the
Servicebase class. Your service will act just like it did when using RestServiceBase but the new api has a bunch of added benefits which are described in the documentation.Use the
[DataMember]and[DataContract]attributes when supporting SOAP endpoints.IRestGetServiceis marked obsolete and you should move to the new style api. In the new api, interfaces such asIGetandIPostcan be used to enforce the correct method signatures but are not required.