0

I have an operation contract in my service contract that accepts a list of data contract objects as an input (void Foo(IList data)). How can I limit the number of data contract items in the collection so that f.ex. not more that 500 can't be sent?

t. Erki.

erkib
  • 35
  • 6

1 Answers1

0

Depending on the binding you use, there are settings that allow you to define the max data size sent from the client or accepted by the service (MaxReceivedMessageSize for instance).

If you want a higher level of granularity than the byte level, you will need to code it in your service implementation and throw a fault if the client sends more than 500 items in the collection.

vc 74
  • 37,131
  • 7
  • 73
  • 89
  • I was kinda hoping there would be some attribute or something like that to control this kind of behaviour and already on client side (aka if the Data Contract would allow maxOccors to be set something else that unbounded, this would work - see here: http://msdn.microsoft.com/en-us/library/ms733112.aspx, section ` with maxOccurs>1 within an `(Collections)) – erkib Dec 07 '11 at 07:23