rest - Service Stack Client for 3rd party needs a parameter called Public -
i have requirement call 3rd party rest api using service stack , working fine.
but 1 of rest api's requires property called "public"
is there attribute can specify give name in class use public name when calls service?
so have definition in class
public string public { get; set; }
the error is
member modifier 'public' must precede member type , name
thanks
ok found needed.
i tried alias attribute servicestack.dataanotations.alias did nothing , not sure for?
i found adding reference system.runtime.serialization needed , adorning class with
[system.runtime.serialization.datacontract]
now each public property needs following attribute or not pass parameter rest server. in case of property called public specifies name in datamember attribute constructor.
[system.runtime.serialization.datamember]
below example
[system.runtime.serialization.datacontract] public class requestvoicebasesearch : voicebasebaseclass, ireturn<responsevoicebasesearch> { [system.runtime.serialization.datamember] public string action { get; set; } [system.runtime.serialization.datamember] public string terms { get; set; } [system.runtime.serialization.datamember] public string { get; set; } [system.runtime.serialization.datamember] public string { get; set; } [system.runtime.serialization.datamember(name = "public")] public bool _public { get; set; } [system.runtime.serialization.datamember] public string rank { get; set; } public requestvoicebasesearch() : base() { this.action = "search"; this.terms = ""; } }
chris
Comments
Post a Comment