我正在处理一个数据契约,如下所示,它使用IExtensiblesDataObject使其与此契约的02版本向前兼容,但我担心通过客户端在网络上传递过多的需要反序列化、重新序列化和发回的数据,可能会发生“意外”拒绝服务。[DataContract(Namespace="http://schemas.myComany.com/sample/01")]
public class Sample : IExtensibleDataOb
有任何方法可以强制限制以数据契约形式传递给给定WCF服务的参数的值吗?[DataContract]{ [Restriction(MinValue = 1, MaxValue = 30)] // Certainly not allowed... or is it?}
当然,没有人期望找到超过30个轮子的车辆,我想把NumberOfWheels的范围限制在1