Setting property and parameter values
Use the SetValue or Add methods to set parameter and property values into the IDO protocol classes.
Add/SetValue with InvokeRequestData
This example shows how to do this with the InvokeRequestData IDO protocol class:
InvokeRequestData invokeRequest = new InvokeRequestData(); int version = 600; DateTime recordDate = DateTime.Now; invokeRequest.IDOName = "MyIDO"; invokeRequest.MethodName = "MyMethod"; invokeRequest.Parameters.Add("Mongoose"); invokeRequest.Parameters.Add(version); invokeRequest.Parameters.Add(Guid.NewGuid()); invokeRequest.Parameters.Add(recordDate); invokeRequest.Parameters.Add(IDONull.Value); // Set later. // Set the fifth parameter after it has been added: invokeRequest.Parameters[4].SetValue(100);
Both the Add and SetValue methods accept a value of any supported .NET data type and automatically handle the conversion to internal format; so, you do not need to think about conversion issues.
Add/SetValue with UpdateCollectionRequestData
The code to set property values into the UpdateCollectionRequestData IDO protocol class is very similar to the previous example.
UpdateCollectionRequestData updateRequest = new UpdateCollectionRequestData(); IDOUpdateItem updateItem = new IDOUpdateItem(); updateItem.Action = UpdateAction.Insert; updateItem.Properties.Add("UserId", IDONull.Value); // Set later. updateItem.Properties.Add("UserName", "MGUser"); updateItem.Properties.Add("RecordDate", DateTime.Now); updateItem.Properties.Add("RowPointer", Guid.NewGuid()); updateItem.Properties["UserId"].SetValue(100L); updateRequest.IDOName = "MyIDO"; updateRequest.Items.Add(updateItem);