您好,我想知道从客户端调用 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; }
}