您好我想知道从客户端调用WCF方法的可能性是什么会忽略区分大小写的属性名称(在客户端我使用JSON使用小写属性名称,但在服务器端使用大写).在这种情况下,WCF无法映射属性.是否可以使用一些WCF属性等?
public interface IMyWCF
{
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
bool UpdateUser(User user);
}
[Serializable]
[DataContract]
public class User : ICloneable
{
[DataMember]
[JsonProperty(PropertyName = "login")]
[StringLength(40, ErrorMessage = "The Login value cannot exceed 40 characters. ")]
[DefaultValue("")]
public String Login { get; set; }
[DataMember]
[JsonProperty(PropertyName = "id")]
public int UserId { get; set; }
}
Run Code Online (Sandbox Code Playgroud)