namespace System.Web.Services.Description {\r
public sealed class OperationMessageCollection : ServiceDescriptionBaseCollection {\r
\r
- #region Fields\r
-\r
- Operation operation;\r
-\r
- #endregion // Fields\r
-\r
#region Constructors\r
\r
internal OperationMessageCollection (Operation operation)\r
+ : base (operation)\r
{\r
- this.operation = operation; \r
}\r
\r
#endregion // Constructors\r
#region Properties\r
\r
public OperationFlow Flow {\r
- [MonoTODO]\r
- get { throw new NotImplementedException (); }\r
+ get { \r
+ switch (Count) {\r
+ case 1: \r
+ if (this[0] is OperationInput)\r
+ return OperationFlow.OneWay;\r
+ else\r
+ return OperationFlow.Notification;\r
+ case 2:\r
+ if (this[0] is OperationInput)\r
+ return OperationFlow.RequestResponse;\r
+ else\r
+ return OperationFlow.SolicitResponse;\r
+ }\r
+ return OperationFlow.None;\r
+ }\r
}\r
\r
public OperationInput Input {\r
- [MonoTODO]\r
- get { throw new NotImplementedException (); }\r
+ get { \r
+ foreach (object message in List)\r
+ if (message is OperationInput)\r
+ return (OperationInput) message;\r
+ return null;\r
+ }\r
}\r
\r
public OperationMessage this [int index] {\r
}\r
\r
public OperationOutput Output {\r
- [MonoTODO]\r
- set { throw new NotImplementedException (); }\r
+ get { \r
+ foreach (object message in List)\r
+ if (message is OperationOutput)\r
+ return (OperationOutput) message;\r
+ return null;\r
+ }\r
}\r
\r
#endregion // Properties\r
\r
public void Insert (int index, OperationMessage operationMessage)\r
{\r
- SetParent (operationMessage, operation);\r
List.Insert (index, operationMessage);\r
}\r
\r
- [MonoTODO]\r
protected override void OnInsert (int index, object value)\r
{\r
- throw new NotImplementedException ();\r
+ if (Count > 2 || (Count > 1 && value.GetType () == this [0].GetType ()))\r
+ throw new InvalidOperationException ("The operation object can only contain one input and one output message.");\r
}\r
\r
- [MonoTODO]\r
protected override void OnSet (int index, object oldValue, object newValue)\r
{\r
- throw new NotImplementedException ();\r
+ if (oldValue.GetType () != newValue.GetType ())\r
+ throw new InvalidOperationException ("The message types of the old and new value are not the same.");\r
+ base.OnSet (index, oldValue, newValue);\r
}\r
\r
- [MonoTODO]\r
protected override void OnValidate (object value)\r
{\r
- throw new NotImplementedException ();\r
+ if (value == null)\r
+ throw new NullReferenceException ("The message object is a null reference.");\r
+ if (!(value is OperationInput || value is OperationOutput))\r
+ throw new ArgumentException ("The message object is not an input or an output message.");\r
}\r
\r
- public void Remove (Operation operationMessage)\r
+ public void Remove (OperationMessage operationMessage)\r
{\r
List.Remove (operationMessage);\r
}\r