Вы находитесь на странице: 1из 55

IDO Development Guide

Version 8.00

Infor
13560 Morris Road
Suite 4100
Alpharetta, Georgia 30004-8508

www.Infor.com
IDO Development Guide

Published in the USA January 2008

Copyright © 2008 Infor. All rights reserved. The word and design marks set forth herein are trademarks and/or registered trademarks of Infor and/or
related affiliates and subsidiaries. All other trademarks listed herein are the property of their respective owners.

Restricted Rights Legend


Use, duplication, or disclosure by the Government is subject to
restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
Technical Data and Computer Software clause at DFARS 252.227-7013,
and Rights in Data-General at FAR 52.227.14, as applicable.
Name of Contractor: Infor, 13560 Morris Road Suite 4100 Alpharetta, Georgia 30004-8508

Date Page Description


1/10/08 2-21 (SL8.00.10) Modified example to depict use with configuration groups.
2/19/08 2-6 Added ReadMode property to LoadCollection (issue 107944)
Contents_________________________________________
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1
For More Information............................................................................................................. 1-1
IDO .NET API and Class Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1
Overview.......................................................................................................................................2-1
IDO Commands Interface .............................................................................................................2-3
IIDOCommands Interface (C#) ............................................................................................. 2-3
IIDOCommands interface (Visual Basic)............................................................................... 2-4
IDO Commands Interface - Request/Response Syntax........................................................ 2-4
APIs and Related IDO Protocol Classes - Details ........................................................................2-5
GetPropertyInfo..................................................................................................................... 2-5
LoadCollection ...................................................................................................................... 2-6
UpdateCollection................................................................................................................... 2-9
Invoke.................................................................................................................................. 2-11
Assigning and Checking Null Values in IDO Requests ..............................................................2-13
Assigning Null Values ......................................................................................................... 2-13
Checking Null Values .......................................................................................................... 2-13
Translation/Localization Considerations.....................................................................................2-14
Internal Format for Numbers ............................................................................................... 2-14
Internal Format for Dates .................................................................................................... 2-14
Type Conversions ............................................................................................................... 2-14
Setting Property and Parameter Values.............................................................................. 2-14
Getting Property and Parameter Values ............................................................................. 2-15
Creating Filter Strings ......................................................................................................... 2-16
Supported .NET CLR Types ............................................................................................... 2-17
Transactions ...............................................................................................................................2-18
Diagnostics and Debugging........................................................................................................2-19
Logging Diagnostic Messages ............................................................................................ 2-19
Wire Tap.............................................................................................................................. 2-19
Standalone Application Communications ...................................................................................2-20
Open Session...................................................................................................................... 2-20
Close Session ..................................................................................................................... 2-20
GetConfigurations ............................................................................................................... 2-20
MongooseConfigs Class (MGShared.dll Class Library)...................................................... 2-23
IDO Extension Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1
About Extension Classes..............................................................................................................3-1
Creating a New IDO Extension Class Project ..............................................................................3-1
Importing Assemblies ...................................................................................................................3-2
Implementing an IDO Extension Class .........................................................................................3-2
Mongoose.IDO.IIDOExtensionClass Interface...................................................................... 3-2
Mongoose.IDO.IIDOExtensionClassContext Interface ......................................................... 3-2
Declaration of an IDO Extension Class for an IDO ............................................................... 3-3
IDO Extension Class Starter Template ................................................................................. 3-3
Adding Methods............................................................................................................................3-4
IDOMethod Parameters ........................................................................................................ 3-4
IDO Event Handlers......................................................................................................................3-5
Adding an IDO Event Handler............................................................................................... 3-5
Event Handler Parameters.................................................................................................... 3-6
Special Cases for UpdateCollection Events.......................................................................... 3-8
Replacing Standard IDO Processing with Event Handlers ................................................... 3-9
Generating Application Events............................................................................................ 3-10

IDO Development Guide i


Copyright © 2008 Infor. All rights reserved.
Contents

Code Samples ............................................................................................................................3-11


LoadCollection Examples.................................................................................................... 3-11
UpdateCollection Examples ................................................................................................ 3-12
Invoke Example................................................................................................................... 3-13
AppDB Class ..............................................................................................................................3-14
Application Database Connections ..................................................................................... 3-14
Application Messages ......................................................................................................... 3-14
Session Variables ............................................................................................................... 3-15
Using AppDB in an Extension Class Method ...................................................................... 3-16
Disposing of IDO Extension Classes ..........................................................................................3-16
Translation/Localization Considerations.....................................................................................3-16
Type Conversions ............................................................................................................... 3-16
Testing Extension Class Assemblies Locally .............................................................................3-18
Debugging Extension Classes....................................................................................................3-18
Logging Diagnostic Messages ............................................................................................ 3-19

ii IDO Development Guide


Copyright © 2008 Infor. All rights reserved.
1
Introduction _____________________________________
Use this guide if you are developing your own IDOs based on the Infor framework, or if you
are extending the functionality of an existing IDO by adding methods and event handlers.
This guide describes the classes and libraries available to you, and provides some
examples of their use.
For More Information
The following additional resources are available:
• Modifying Infor ERP SL includes a list and descriptions of the tools available for
creating and editing forms, IDOs, application events and event handlers. It also
describes the administrative and development utilities to use for managing a
development project and deploying an application.
That guide also includes information you may need about external touch points, strong
data types, application messages, licensing for IDOs, and so on. We strongly
recommend that you read through the Modifying Infor ERP SL guide before creating or
modifying IDOs.
• Integrating IDOs with External Applications includes an overview of what IDOs are
and the different ways that applications can interface with IDOs. It provides examples
and syntax showing how to set up IDO requests and responses in different protocols
(XML documents, the application event system, .NET Web service, and so on).
• Guide to the Application Event System describes the application event system,
which developers and system administrators can use to create events and event
handlers that automate tasks. It also contains sample scenarios that will help you
understand how you can take advantage of the application event system.

IDO Development Guide 1-1


Copyright © 2008 Infor. All rights reserved.
Introduction

1-2 IDO Development Guide


Copyright © 2008 Infor. All rights reserved.
2
IDO .NET API and Class Library ________________
Overview
Developers can use the IDO .NET class library to programmatically access the SyteLine
business objects, which are called IDOs (Intelligent Data Objects).
Interactions with the IDO are based on requests and responses. The caller constructs an
IDO request and sends it to the IDO runtime service to be executed. The IDO runtime
service constructs and returns a response to the caller containing the results of the action
requested.
All client access to the application database is through the IDOs. The primary
responsibilities of the IDO runtime include querying data sets (LoadCollection), saving data
(UpdateCollection), and calling methods (Invoke).
Each IDO request has a request type such as OpenSession, LoadCollection,
UpdateCollection, or Invoke. It also contains an optional request payload that is dependent
on the request type. For example, the payload for an OpenSession request contains logon
information for a user such as user ID, password, and configuration.
The API is used by standalone client applications, WinStudio scripts, user controls and
within IDO extension classes. The same programming interface is available on the client
using the Mongoose.IDO.Client class and from an IDO extension class using the
Me.Context.Commands property. This chapter focuses on use of the class library; the
extension classes are described in Chapter 3, “IDO Extension Classes."
IDO .NET Class Library
The IDORequestClient .NET class library has one class, Client. It is in the
Mongoose.IDO.Client namespace. This class library replaces the RSDAO COM library
used in previous versions of SyteLine.
The Client class implements the IDO command interface (LoadCollection,
UpdateCollection, and Invoke), plus additional commands (OpenSession,
GetConfigurations, CloseSession) that are only used for external application
communications.
IDO Protocol Class Library
The IDOProtocol .NET class library contains classes that correspond to each level in the
hierarchy of an IDO request or response. These classes are used to construct IDO requests
and responses. All IDOProtocol classes are in the Mongoose.IDO.Protocol namespace.
The top level of the IDOProtocol class hierarchy is implemented by the
IDORequestEnvelope class, and the IDO request (RequestHeader in XML) is
implemented by the IDORequest class. The request payload implementation (if any) varies
depending on the request type. For an OpenSession request, the payload is implemented
by the OpenSessionRequestData class. The payload for a LoadCollection request is
implemented by the LoadCollectionRequestData class. There are other similar classes
for each request type that carries a payload.

IDO Development Guide 2-1


Copyright © 2008 Infor. All rights reserved.
IDO .NET API and Class Library

The IDO responses are implemented in classes that mirror the requests, with the
IDOResponseEnvelope at the top of the hierarchy.
As an example, the following steps are required to execute an IDO runtime Invoke call
using IDOProtocol classes:
1. Create a new IDORequestEnvelope instance.
2. Set the IDORequestEnvelope.SessionID property.
3. Create a new IDORequest instance.
4. Set the IDORequest.Type property = Invoke.
5. Create a new InvokeRequestData instance.
6. Set the InvokeRequestData.IDOName property.
7. Set the InvokeRequestData.MethodName property.
8. Add the parameters to the InvokeRequestData.Parameters collection.
9. Add the IDORequest to the IDORequestEnvelope.Requests collection.
10. Set the payload for the IDORequest using the IDORequest.SetPayload method.
11. Send your completed IDORequestEnvelope to the IDO runtime and receive the
IDOResponseEnvelope in return.
IDO Commands Interface
Whether you are writing code on the client side or in an IDO extension class, the framework
also provides wrapper methods through the IDO Commands interface, These wrappers
typically reduce IDO interactions to a single line of code.
However, a limitation of using the IDO Commands interface is that you can specify only one
IDO request per command, and receive one response per command. When using the
IDOProtocols classes instead, you can build one IDORequestEnvelope that includes
multiple requests, and then receive one response that includes information for all the
requests.
AppDB Class
The AppDB class, part of the Mongoose.IDO.DataAccess namespace, is available only
to extension classes. It provides direct access to the application database, plus access to
common framework features such as application messages and session variables. For
more information about this class, see “AppDB Class” on page 3-14.

2-2 IDO Development Guide


Copyright © 2008 Infor. All rights reserved.
IDO .NET API and Class Library

IDO Commands Interface


This basic IDO runtime API is defined by the IIDOCommands interface, which is shown
below, in both C# and VB format. The properties used in each request type are explained
later in this chapter.
IIDOCommands Interface (C#)
public interface IIDOCommands
{
GetPropertyInfoResponseData GetPropertyInfo( string idoName );

LoadCollectionResponseData LoadCollection(
LoadCollectionRequestData requestData );

UpdateCollectionResponseData UpdateCollection(
UpdateCollectionRequestData requestData );

InvokeResponseData Invoke(
InvokeRequestData requestData );

string[] GetIDONames();

LoadCollectionResponseData LoadCollection(
string idoName,
string propertyList,
string filter,
string orderBy,
int recordCap );

LoadCollectionResponseData LoadCollection(
string idoName,
PropertyList propertyList,
string filter,
string orderBy,
int recordCap );

InvokeResponseData Invoke(
string idoName,
string methodName,
params object[] parameters );
}

IDO Development Guide 2-3


Copyright © 2008 Infor. All rights reserved.
IDO .NET API and Class Library

IIDOCommands interface (Visual Basic)


Public Interface IIDOCommands

Function GetIDONames() As String()

Function GetPropertyInfo(ByVal idoName As String) As


GetPropertyInfoResponseData

Function GetPropertyInfo(ByVal idoName As String, ByVal


includeClassNotesFlag As Boolean) As GetPropertyInfoResponseData

Function Invoke(ByVal requestData As InvokeRequestData) As


InvokeResponseData

Function Invoke(ByVal idoName As String, ByVal methodName As String,


ByVal ParamArray parameters() As Object) As InvokeResponseData

Function LoadCollection(ByVal requestData As


LoadCollectionRequestData) As LoadCollectionResponseData

Function LoadCollection( _
ByVal idoName As String, _
ByVal propertyList As PropertyList, _
ByVal filter As String, _
ByVal orderBy As String, _
ByVal recordCap As Integer) As LoadCollectionResponseData

Function LoadCollection( _
ByVal idoName As String, _
ByVal propertyList As String, _
ByVal filter As String, _
ByVal orderBy As String, _
ByVal recordCap As Integer) As LoadCollectionResponseData

Function UpdateCollection(ByVal requestData As


UpdateCollectionRequestData) As UpdateCollectionResponseData

End Interface

IDO Commands Interface - Request/Response Syntax


The IDO Commands interface provides a simple alternative to constructing IDO requests
when interacting with IDOs. The process of creating an IDORequestEnvelope,
IDORequest and payload class instance for each interaction is replaced by a single method
call, which will construct the request for you using the parameter list.

2-4 IDO Development Guide


Copyright © 2008 Infor. All rights reserved.
IDO .NET API and Class Library

APIs and Related IDO Protocol Classes - Details


This section describes each API and associated protocol classes, and provides examples
of each.
About the Examples
The examples in this section use the syntax of extension class methods, for example:
... Me.Context.Commands.LoadCollection(request)

The syntax for using the IIDOCommands interface will be different in other contexts such
as a form script or a standalone client application.
GetPropertyInfo
Use GetPropertyInfo to retrieve a list of properties and their attributes for an IDO.
Properties
The following table describes the properties available on the LoadCollectionRequestData
class

Property Data Type Description


IDOName System.String Identifies the IDO used to execute the
request.
IncludeClassNotesFlag System.Boolean If true, set the ClassNotesExist property
in the response to indicate if any class
notes exist for this IDO (only available if
using the Client class GetResponse
method).

GetPropertyInfo Example
Dim response As GetPropertyInfoResponseData

response = Me.Context.Commands.GetPropertyInfo("SLItems")
For Each idoProp As PropertyInfo in response.Properties
String propertyName = idoProp.Name
' etc
Next

IDO Development Guide 2-5


Copyright © 2008 Infor. All rights reserved.
IDO .NET API and Class Library

LoadCollection
Queries are performed using the LoadCollection API and associated protocol classes.
LoadCollection requests can be constructed using the LoadCollectionRequestData IDO
protocol class.
Properties
The following table describes the properties available on the LoadCollectionRequestData
class.

Property Data Type Description


IDOName System.String Identifies the IDO used to execute the
request.
ReadMode Mongoose.IDO.Protocol. Specify the collection read mode, which
ReadMode controls the isolation level used when
executing queries (see the online help on
Process Defaults). Options are:
ReadCommitted
ReadUncommitted
Default
This property does not apply to custom
load methods.
PropertyList Mongoose.IDO.Protocol. A subset of properties published by the
PropertyList IDO to be included in the response.
Filter System.String A filter or WHERE clause to be used for the
query. Default: empty
RecordCap System.Int32 The maximum number of items to return in
the response. The setting 0 returns all
items. The setting -1 uses the default cap
(200). Default: -1.
OrderBy System.String A list of property names used to override
the default sort order. Only bound
properties may be included in OrderBy.
Default: empty.
Distinct System.Boolean If this flag is set to True, the request
returns a set of items containing only the
unique combinations of properties named
in the PropertyList property. Default:
False.
CustomLoadMethod Mongoose.IDO.Protocol. Allows the caller to specify a method to
CustomLoadMethod perform the query in place of the standard
query built by the IDO runtime.
PostQueryCommand System.String Allows the caller to specify a method to be
executed for each item returned by the
query. The method must be a member of
the IDO specified by the IDOName
property. Default: empty.
LinkBy Mongoose.IDO.Protocol. Applies to inner nested LoadCollection
PropertyPair array requests only and specifies the relationship
between a parent and child IDO in terms of
property pairs. Use the SetLinkBy method
to set this property. Default: empty.

2-6 IDO Development Guide


Copyright © 2008 Infor. All rights reserved.
IDO .NET API and Class Library

Property Data Type Description


NestedRequests System.Collections. A collection of additional
ICollection LoadCollectionRequestData instances
used to load child collections.
LoadCap System.Int32 Specifies the maximum number of nested
LoadCollection requests to process. For
example, if this property is set to 1, and
200 items are returned by the parent
LoadCollection request, only the first
parent item in the response will contain
nested child items.

LoadCollection Example 1: Using the Protocol Class


To execute a LoadCollection request, first construct an instance of the
LoadCollectionRequestData class, and pass it to the LoadCollection method on the
IIDOCommands interface.
Dim request As New LoadCollectionRequestData
Dim response As LoadCollectionResponseData

request.IDOName = "SLItems"
request.PropertyList.SetProperties("Item, Description, QtyOnHand")
request.Filter = "Item LIKE N'AB%'"
request.OrderBy = "QtyOnHand"
request.RecordCap = 0
response = Me.Context.Commands.LoadCollection(request)

LoadCollection Example 2: Using the Commands Interface


In many cases it will be more convenient to call the overloaded version of the
LoadCollection method that accepts parameters for the required and most common
LoadCollectionRequestData properties.
Dim response As LoadCollectionResponseData

' this is equivalent to example 1


response = Me.Context.Commands.LoadCollection( _
"SLItems", _
"Item, Description, QtyOnHand", _
"Item LIKE N'AB%'", _
"QtyOnHand", _
0)

IDO Development Guide 2-7


Copyright © 2008 Infor. All rights reserved.
IDO .NET API and Class Library

LoadCollection Example 3: Accessing Item Properties


The LoadCollection methods return an instance of the LoadCollectionResponseData
class, which is populated with the same values that were sent in the request plus the results
from the query. These results are accessed through the Items property, which is a
collection of IDOItem instances. Properties can be accessed through the IDOItem
instances or directly using the indexer on the LoadCollectionResponseData class.
' the two loops in this example are equivalent
Dim x As Integer = response.PropertyList.IndexOf("QtyOnHand")
Dim qty As Integer = 0

For Each item As IDOItem In response.Items


qty = qty + item.PropertyValues(x).GetValue(Of Integer)()
Next

qty = 0
For row As Integer = 0 To response.Items.Count
qty = qty + response(row, "QtyOnHand").GetValue(Of Integer)()
Next

2-8 IDO Development Guide


Copyright © 2008 Infor. All rights reserved.
IDO .NET API and Class Library

UpdateCollection
Updates (includes inserts, updates and deletes) are performed using the UpdateCollection
API and associated protocol classes. UpdateCollection requests can be constructed using
the UpdateCollectionRequestData IDO protocol class. The following table describes the
properties available on the UpdateCollectionRequestData class.
Properties
Property Data Type Description
IDOName System.String Identifies the IDO used to execute the
request.
CollectionID System.String An identifier associated with this
UpdateCollection request.
RefreshAfterUpdate System.Boolean A boolean value used to indicate if the
caller wants the response to contain
the updated items refreshed after they
were saved.
CustomInsert System.String These properties are used to specify
custom actions to use when saving
CustomUpdate items. Note: same as custom
CustomDelete INS/UPD/DEL in WinStudio.
LinkBy Mongoose.IDO.Protocol. Applies to inner nested
PropertyPair array UpdateCollection requests only and
specifies the relationship between a
parent and child IDO in terms of
property pairs. Use the SetLinkBy
method to set this property. Default:
empty.
Items Mongoose.IDO.Protocol. An instance of the IDOUpdateItems
IDOUpdateItems class that contains zero or more
IDOUpdateItem instances. The
IDOUpdateItem class contains the
update information for a single item.

To execute an UpdateCollection request, first construct an instance of the


UpdateCollectionRequestData class, and pass it to the UpdateCollection method on the
IIDOCommands interface.
UpdateCollection Example
Dim request As New UpdateCollectionRequestData
Dim response As UpdateCollectionResponseData
Dim newCust As New IDOUpdateItem

request.IDOName = "SLCustomers"
request.RefreshAfterUpdate = True

newCust.Action = UpdateAction.Insert
newCust.ItemNumber = 1 ' used for error reporting
newCust.Properties.Add("CustNum", "C000100")
newCust.Properties.Add("Name", "Boxmart")
newCust.Properties.Add("CurrCode", "USD")
newCust.Properties.Add("BankCode", "BK1")

request.Items.Add(newCust)

response = Me.Context.Commands.UpdateCollection(request)

IDO Development Guide 2-9


Copyright © 2008 Infor. All rights reserved.
IDO .NET API and Class Library

LoadCollection/UpdateCollection Example: Saving Changes to


Existing Records
This example loads data from an IDO, updates the data and saves the collection.
Public Sub DoUpdate()
Dim Loadresponse As LoadCollectionResponseData
Dim sCoNum As String
Dim sFilter As String

sCoNum = ThisForm.PrimaryIDOCollection.GetCurrentObjectProperty("CoNum")

sFilter = "CoNum = '" & sCoNum & "'"

Loadresponse = Me.IDOClient.LoadCollection("SLCos", "Charfld1, CustNum", sFilter, "",


-1)

If Loadresponse.Items.Count > 0 Then


Dim updateRequest As UpdateCollectionRequestData
Dim updateItem As IDOUpdateItem

' create a new UpdateCollection request


updateRequest = New UpdateCollectionRequestData("SLCos")

' create a new update item for the row we loaded


updateItem = New IDOUpdateItem(UpdateAction.Update, Loadresponse.Items(0).ItemID)

' add CustNum property from LoadResposne, not modified


updateItem.Properties.Add("CustNum", Loadresponse(0, "CustNum").Value, False)

' add Charfld1 property using a new value, modified


updateItem.Properties.Add("Charfld1", "Owzat?", True)

' add the update item to update request


updateRequest.Items.Add(updateItem)

' save changes


Me.IDOClient.UpdateCollection(updateRequest)

End If

End Sub

2-10 IDO Development Guide


Copyright © 2008 Infor. All rights reserved.
IDO .NET API and Class Library

Invoke
IDO methods (not including custom load methods) are called uting using the Invoke API
and associated protocol classes. Invoke requests can be constructed using the
InvokeRequestData IDO protocol class. The following table describes the properties
available on the InvokeRequestData class.
Properties
Property Data Type Description
IDOName System.String Identifies the IDO used to execute the
request.
MethodName System.String Identifies the IDO method to be executed.
Parameters Mongoose.IDO.Protocol. A collection containing instances of the
InvokeParameterList InvokeParameter class corresponding to
the IDO method parameters.

To execute an Invoke request, first construct an instance of the InvokeRequestData class,


and pass it to the Invoke method on the IIDOCommands interface.
Invoke Example 1
Dim request As New InvokeRequestData
Dim response As InvokeResponseData

request.IDOName = "UserNames"
request.MethodName = "UserValidSp"
request.Parameters.Add("ajones") ' user name, input
request.Parameters.Add(IDONull.Value) ' user ID, output
request.Parameters.Add(IDONull.Value) ' description, output
request.Parameters.Add(IDONull.Value) ' infobar, output
response = Me.Context.Commands.Invoke(request)

If response.IsReturnValueStdError Then
' get infobar output parameter
Dim errorMsg As String
errorMsg = response.Parameters(3).Value
Else
Dim userID As Integer
Dim desc As String

userID = response.Parameters(1).GetValue(Of Integer)()


If Not response.Parameters(2).IsNull Then
desc = response.Parameters(2).Value
End If
End If

In many cases it will be more convenient to call the overloaded version of the Invoke
method that accepts parameters for the IDOName, MethodName and method parameters
InvokeRequestData properties.

IDO Development Guide 2-11


Copyright © 2008 Infor. All rights reserved.
IDO .NET API and Class Library

Invoke Example 2
Dim response As InvokeResponseData

response = Me.Context.Commands.Invoke( _
"UserNames", _
"UserValid", _
"ajones", _
IDONull.Value, _
IDONull.Value, _
IDONull.Value)

If response.IsReturnValueStdError Then
' get infobar output parameter
Dim errorMsg As String
errorMsg = response.Parameters(3).Value
Else
Dim userID As Integer
Dim desc As String

userID = response.Parameters(1).GetValue(Of Integer)()


If Not response.Parameters(2).IsNull Then
desc = response.Parameters(2).Value
End If
End If

2-12 IDO Development Guide


Copyright © 2008 Infor. All rights reserved.
IDO .NET API and Class Library

Assigning and Checking Null Values in IDO Requests


Assigning Null Values
When assigning a null value to a property or parameter in the IDO protocol classes, the best
practice is to use the IDONull.Value static property.
Dim myMethodResponse As InvokeResponseData
Dim updateRequest As UpdateCollectionRequestData

' pass NULL for the 3rd parameter


myMethodResponse = Me.Invoke("MyMethod", "test", 100, IDONull.Value)

' set the Note property to NULL


updateRequest.Items(0).Properties.Add("Note", IDONull.Value)

Checking Null Values


When checking for null values, the best practice is to use the IDONull.IsNull static method.
For parameter or property values in an IDO protocol class, you may also use the IsNull
property to check for null values.
' Check for null value in a LoadCollectionResponseData
If Not loadResponse(0, "UserId").IsNull Then
userId = loadResponse(0, "UserId").GetValue(Of Long)(-1)
End If

' check for a null parameter value


Public Function MyFunc(ByVal param As Nullable(Of Integer)) As Integer

If IDONull.IsNull(param) Then ' test for null value


' handle null param
End If

IDO Development Guide 2-13


Copyright © 2008 Infor. All rights reserved.
IDO .NET API and Class Library

Translation/Localization Considerations
All data values in IDO requests and responses are stored as string values in an "internal"
format that is independent of any regional settings for the application or local machine
where the code is executing.
Internal Format for Numbers
Numeric values are always stored internally using a period for the decimal separator (for
non-integer values) and without any digit-grouping characters.
Internal Format for Dates
Date values are always stored internally using the format YYYYMMDD HH:MM:SS.mmm
for date and time, YYMMDD for date only, and HH:MM:SS.mmm for time only (milliseconds
are optional).
Type Conversions
The IDO protocol classes store all property and parameter values internally as strings in a
non-localized internal format. However, the framework also provides methods that allow
you to transparently convert between supported native .NET CLR data types and the
internal formatted string values. You should always use strongly typed variables when
getting values from, or putting values into, any of the IDO protocol classes in order to take
advantage of this feature and avoid problems related to systems running with different
regional settings. This is especially important when working with date and numeric values.
The built-in VB functions for data type conversions (CStr, CDate, CInt, etc.) are sensitive
to the regional settings for the application or local machine.
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
The following example shows how to do this with the InvokeRequestData IDO protocol
class.
Dim invokeRequest As New InvokeRequestData
Dim version As Integer = 600
Dim recordDate As DateTime = 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

' to 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 that the developer does not need
to think about conversion issues.

2-14 IDO Development Guide


Copyright © 2008 Infor. All rights reserved.
IDO .NET API and Class Library

Add/SetValue with UpdateCollectionRequestData


The code to set property values into the UpdateCollectionRequestData IDO protocol
class is very similar to the previous example.
Dim updateRequest As New UpdateCollectionRequestData
Dim updateItem As 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)

Getting Property and Parameter Values


Use one of the overloaded GetValue methods to get parameter and property values from
the IDO protocol classes. The following examples show how to do this using the
LoadCollectionResponseData IDO protocol class.
GetValue with LoadCollectionResponseData
In this example, the desired native .NET data type is specified as an additional parameter
in the call to GetValue (using the .NET Framework's generics feature).
Dim loadResponse As LoadCollectionResponseData
Dim userId As Long
Dim userName As String
Dim recordDate As DateTime
Dim rowPointer As Guid

loadResponse = Me.Context.Commands.LoadCollection( _
"UserNames", _
"UserId, UserName, RecordDate, RowPointer", _
"", "", 0)

userId = loadResponse(0, "UserId").GetValue(Of Long)()


userName = loadResponse(0, "UserName").GetValue(Of String)()
recordDate = loadResponse(0, "RecordDate").GetValue(Of DateTime)()
rowPointer = loadResponse(0, "RowPointer").GetValue(Of Guid)()

Handling Nullable Values


Be aware that if any of the values are null, this version of the GetValue method throws an
exception. When working with nullable values, you have three options to avoid throwing an
exception:
• Check the IsNull property before calling GetValue.
• Call the overloaded GetValue method with a default value to be returned in case of null.
• Use .NET nullable value types.

IDO Development Guide 2-15


Copyright © 2008 Infor. All rights reserved.
IDO .NET API and Class Library

Those three techniques are illustrated in this example:


Dim loadResponse As LoadCollectionResponseData
Dim userId As Long
Dim userId2 As Nullable(Of Long)

loadResponse = Me.Context.Commands.LoadCollection( _
"UserNames", _
"UserId, UserName, RecordDate, RowPointer", _
"", "", 0)

' Check for null before calling GetValue


If Not loadResponse(0, "UserId").IsNull Then
userId = loadResponse(0, "UserId").GetValue(Of Long)()
Else
userId = -1
End If

' Calling GetValue, return -1 if null


userId = loadResponse(0, "UserId").GetValue(Of Long)(-1)

' Calling GetValue, check for null return value


userId = loadResponse(0, "UserId").GetNullableValue(Of Long)()
If Not userId.HasValue Then userId = -1

Creating Filter Strings


If you need to dynamically build a SQL filter (WHERE clause) to be used in a
LoadCollection request, the framework provides the SqlLiteral class to help build filter
strings that contain embedded literals.
SqlLiteral.Format Method
The static SqlLiteral.Format method accepts any supported .NET CLR typed value and
converts it into a literal that can be used when constructing a filter as shown in the following
example:
Dim filter As String

filter = String.Format( _
"SessionId = {0} AND trans_num = {1}", _
SqlLiteral.Format(SessionID), _
SqlLiteral.Format(TransNum))

The above example will produce a filter with the appropriate syntax for the literal values,
similar to this:
SessionId = N' 7A4930D6-AE9E-4F32-9687-17ABDBF4E818' and trans_num =
1234

You must always pass in a strongly typed value in order to get the correct result. For
example, you should not pass a string containing a date value.

2-16 IDO Development Guide


Copyright © 2008 Infor. All rights reserved.
IDO .NET API and Class Library

The following table shows some examples of input types, values, and the
SqlLiteral.Format result for each.

.NET CLR Type Input Value SqlLiteral.Format Result


System.DateTime 12/31/2006 23:59:59.999 N'20061231 23:59:59.999'
System.Int32 123 123
System.String Joe's Bar N'Joe''s Bar'
System.Decimal 150.32 150.32
System.Guid 7A4930D6-AE9E-4F32-9687- N' 7A4930D6-AE9E-4F32-9687-
17ABDBF4E818 17ABDBF4E818'

Supported .NET CLR Types


The following .NET data types are supported by the IDO protocol classes using the
GetValue, Add, and SetValue methods.
System.String System.Char
System.DateTime System.Int32
System.UInt32 System.Int16
System.UInt16 System.Int64
System.UInt64 System.SByte
System.Byte System.Single
System.Double System.Guid
System.Decimal System.Boolean
System.Byte[]

IDO Development Guide 2-17


Copyright © 2008 Infor. All rights reserved.
IDO .NET API and Class Library

Transactions
The IDO runtime automatically executes all UpdateCollection requests in a transaction. It
also executes IDO methods in a transaction if they are marked as "transactional" methods.
All other IDO requests are executed without a transaction. Note that if a method is not
marked "transactional" is called from a method that is marked "transactional", then it will
still execute in the caller's transaction.
For transactional IDO methods, if the method returns an integer value less than 5, the
transaction will be committed. The exception is if the method was executed within an
existing outer transaction. Then the transaction will commit if and when the outer
transaction commits. If the IDO method returns an integer value greater than or equal to 5
the transaction will be rolled back immediately. The Infor ERP SL standard is to return 16
to indicate a method failed. The transaction will also roll back if the method throws an
exception.
If you need finer grained control over transaction scope, which is often necessary for long
running processes, this can be achieved while still allowing the IDO runtime to manage
transactions.
For example, consider a method that will post a large batch of records. We need a method
that will read the batch, loop through each record and attempt to post it. If the post is
successful the action should commit, otherwise it should be rolled back. The best way to
accomplish this is to create two methods: a top level entry point method that will query the
records to be posted, and another method to do the posting. The top level method should
not be marked as transactional, while the posting will be transactional. The entry point
method will query the records to be posted and loop through each one calling the posting
method to post each record. This way if a record fails to post it will not roll back all posted
records, only the failed record.

2-18 IDO Development Guide


Copyright © 2008 Infor. All rights reserved.
IDO .NET API and Class Library

Diagnostics and Debugging


Logging Diagnostic Messages
All applications and services in the Infor framework use a common message logging facility.
This enables the framework to provide a single, consolidated view of all activity logged on
the local machine. For developers, this log is available in the IDO Runtime Development
Server (IDORuntimeHost.exe).
Message Logging API
Public Shared Sub LogUserMessage( _
ByVal messageSource As String, _
ByVal messageType As UserDefinedMessageType, _
ByVal message As String)

Public Shared Sub LogUserMessage( _


ByVal messageSource As String, _
ByVal messageType As UserDefinedMessageType, _
ByVal format As String, _
ByVal ParamArray args As Object())

Parameters
• messageSource - A short, user-defined identifier of the source of a message (for
example, class or project name).
• messageType - One of the UserDefinedMessageType enumeration values; used for
searching and filtering log messages.
• message - A string containing the log message text.
• format - A log message format string (see String.Format() in the .NET Framework
documentation for more information about formatting strings).
• args - A variable-length list of format-string substitution parameters
Examples
IDORuntime.LogUserMessage( _
"SLCustomers", _
UserDefinedMessageType.UserDefined0, _
"Method A() called.")

IDORuntime.LogUserMessage( _
"SLCustomers", _
UserDefinedMessageType.UserDefined0, _
"Parameter 1 is {0}.", _
p1)

Wire Tap
You can use the Wire Tap feature of the IDO Runtime Development Server to monitor all
the IDO request and response documents generated by a specific user session. For more
information see the online help for the IDO Runtime Development Server.

IDO Development Guide 2-19


Copyright © 2008 Infor. All rights reserved.
IDO .NET API and Class Library

Standalone Application Communications


When you create an instance of the Client class, it includes some commands
(OpenSession, GetConfiguration, CloseSession) that are only used for external application
communications.
To open sessions or access configuration information from an external application:
1. Create a VS 2005 .NET executable (C#, VB, etc.) or any other program where you can
reference and execute methods on a .NET 2.0 class library.
2. Add references in your project's definition to the following Mongoose framework's class
libraries.
• IDOProtocol.dll
• IDORequestClient.dll
• MGShared.dll
Open Session
The OpenSession method is used to create a new SL session (log in).
OpenSession Example
This example creates a new Client instance accessing the IDO runtime using the URL in
requestServiceURL, where this URL is similar to the following:
"http://servername/IDORequestService/RequestService.aspx"
Dim client As Client = New Client(requestServiceURL)
Dim response As OpenSessionResponseData

Using client
' substitute a valid SL user, password and configuration name
response = client.OpenSession("user", "password", "config")
If response.LogonSucceeded Then
Console.WriteLine("Success")
End If

' close the session when finished


client.CloseSession()
End Using ' Using block guarentees client is properly disposed

Close Session
The CloseSession method is used to close an existing session (log out).
The OpenSession example above also includes an example of CloseSession.
GetConfigurations
WinStudio/SL configuration information is stored in MongooseConfigs.xml. By default,
this file is created and resides in c:\Documents and Settings\All Users\Application
Data\Mongoose.
The Client class accesses configuration information through the ConfigServer.aspx page
(IDORequestService ASP.NET Web server application) in conjunction with the IDO
Runtime Service or the IDORuntimeHost.exe developer tool. The Web Server application,
IDO Runtime Service and IDORuntimeHost.exe are all installed as part of a Infor ERP SL
utility server install. Configuration information obtained via the GetConfigurations static
method includes a subset of configuration properties and all of the referenced application
properties.

2-20 IDO Development Guide


Copyright © 2008 Infor. All rights reserved.
IDO .NET API and Class Library

In code that utilizes the Client class, include the following using statements (Import
statements if written in a VB project):
using Mongoose.Core.Configuration;
using Mongoose.IDO.Protocol;
using Mongoose.IDO;

ConfigurationInfo Example 1
The following snippet of code retrieves an array of ConfigurationInfo classes through the
IDORequestService. (Infor IDO Runtime Service must be running for this method to work.)
//********************************************************************
// The following line calls the IDORequestClient ASPX web application
// to retrieve the configuration list via an array of ConfigurationInfo
// classes.
// Parm -> URL to IDORequestClient's ConfigServer.apsx file.
//********************************************************************
ConfigurationInfoList configList = null;
configList = Client.GetConfigurations(
@"http://server1/
IDORequestService/ConfigServer.aspx", "Acme" );
// Config info can be enumerated as follows
foreach ( ConfigurationInfo config in configList )
{
// do whatever
}

ConfigurationInfo Example 2
The following snippet of code retrieves an array of ConfigurationInfo classes through
IDORuntimeHost.exe. (IDORuntimeHost.exe must be running for this method to work.)
//********************************************************************
// The following line calls through to the local IDO runtime service
// (IPC protocol) to retrieve the configuration list via an array of
// ConfigurationInfo classes.
// Note: No parameter is passed to the GetConfigurations() method.
//********************************************************************
ConfigurationInfoList configList = null;
configList = Client.GetConfigurations();

// Config info can be enumerated as follows


foreach ( ConfigurationInfo config in configList )
{
// do whatever
}

Properties
The following configuration/application properties are available through the
ConfigurationInfo class.

Some information in the MongooseConfigs.xml file related to database


connections, user names, passwords, etc., is encrypted. The methods
described here simply retrieve the encrypted strings for these entities. If they
need programmatic access to this information (that is, decrypted strings),
contact Infor Professional Services to discuss methods for decrypting it.

public bool ActiveScriptingOnly;

IDO Development Guide 2-21


Copyright © 2008 Infor. All rights reserved.
IDO .NET API and Class Library

public string AppName;


public string AppURL;
public string BaseHelpFile;
public bool ColSecurityPrimaryOnly;
public string CompanyName;
public string Copyright;
public string DefFormBGColor;
public string DefFormFGColor;
public string DefFormFont;
public string DefNormalBGColor;
public string DefNormalFGColor;
public string DefReadOnlyBGColor;
public string DefReadOnlyFGColor;
public string DefRequiredBGColor;
public string DefRequiredFGColor;
public string DefTbdBGColor;
public string DefTbdFGColor;
public string DeleteExistingPrompt;
public string DeleteNewPrompt;
public bool DisableInvalidValuePrompt;
public string FormCLSID;
public string FormFileExtension;
public string FormsURL;
public string HelpBasePath;
public string HelpContentsIndexMenuText;
public string HorzComponentSpacing;
public string IconFilename;
public string LoginOverrideProgID;
public string Name;
public string ObjectMenuName;
public bool PrimaryCacheUsesFormCaption;
public string ProgIDRootAugment;
public string ReportViewerExecutable;
public string ReportViewerExecutablePath;
public bool RightJustifyNewLabels;
public string SplashFilename;
public bool UseHtmlHelp;
public bool ValidationErrorIndicators;
public string VBAFilename;
public string Version;
public string VertComponentSpacing;
public string WallpaperDisplayOption;
public string WallpaperFilename;
public bool XPVisualStyle;

2-22 IDO Development Guide


Copyright © 2008 Infor. All rights reserved.
IDO .NET API and Class Library

MongooseConfigs Class (MGShared.dll Class Library)


An alternative way to get configuration information programmatically is to use the
MongooseConfigs class. It accesses configuration information directly through a set of
methods that load an XML file and parse the XML information into retuned classes. An
instance of the class must be instantiated and separate methods are used to retrieve the
list of configurations, configuration properties, application properties, and DB connection
information (DB connection information is returned as an encrypted string.)
To do this:
1. Create a VS 2005 .NET executable (C#, VB, etc.) or any other program where you can
reference and execute methods on a .NET 2.0 class library.
2. Add a reference in your project's definition to the MGShared.dll Mongoose framework's
class library.
3. In code that utilizes the Client class, include the following using statements (Import
statements if written in a VB project)
using Mongoose.Core.Configuration;
using Mongoose.Core.Common;

Example
The following snippet of code retrieves an array of configuration names, gets the
application name and a couple of application properties, and finally retrieves the Runtime
Forms Database name (encrypted.)
// Create instance of ManageConfigs class
MongooseConfigs ManageConfigs = null;
ManageConfigs = new MongooseConfigs();
// Load MongooseConfigs.xml
ManageConfigs.Load(true);
// Get array of the configuration names
string[] configNames = ManageConfigs.GetConfigNames();
foreach ( string configName in configNames )
{
// Get config info
Configuration config = ManageConfigs.GetConfig( configName );
// Get Application info
AppProperties appInfo = ManageConfigs.GetAppProperties(
config.Application );
// Get Connection Info (most properties here are encrypted)
ConnectionProfile connProfile = ManageConfigs.GetFormsConnection(
configName,
ConnectionProfileType.Runtime );
// Note: Various information can be retrieved from the Configuration,
AppProperties, and
// ConnectionProfile classes. You can view the availabe class
properties via intellisense
// when programming against them.
}

IDO Development Guide 2-23


Copyright © 2008 Infor. All rights reserved.
IDO .NET API and Class Library

Properties
The following configuration/application properties are available through the Configuration
class:
public string Application;
public string ConfigName;
public ArrayList ConnectionRoles;
public bool FormControlSSEnabled;
public string ObjectStudioProjBuildDir;
public bool ObjectStudioSSEnabled;
public string SSPassword; (encrypted string)
public string SSProjectName;
public string SSUNCPath;
public string SSUserId; (encrypted string)

The following configuration/application properties are available through the AppProperties


class:
public bool ActiveScriptingOnly;
public string Application;
public string AppName;
public string BaseHelpFile;
public bool ColSecurityPrimaryOnly;
public string CompanyName;
public string Copyright;
public string DefFormBGColor;
public string DefFormFGColor;
public string DefFormFont;
public string DefNormalBGColor;
public string DefNormalFGColor;
public string DefReadOnlyBGColor;
public string DefReadOnlyFGColor;
public string DefRequiredBGColor;
public string DefRequiredFGColor;
public string DefTbdBGColor;
public string DefTbdFGColor;
public string DeleteExistingPrompt;
public string DeleteNewPrompt;
public bool DisableInvalidValuePrompt;
public string FormCLSID;
public string FormFileExtension;
public string HelpBasePath;
public string HelpContentsIndexMenuText;
public string HorzComponentSpacing;
public string IconFilename;
public string LoginOverrideProgID;
public string ObjectMenuName;
public bool PrimaryCacheUsesFormCaption;
public string ProgIDRootAugment;
public string RelFormServerURL;
public string RelWebServerURL;
public string ReportViewerExecutable;
public string ReportViewerExecutablePath;
public bool RightJustifyNewLabels;

2-24 IDO Development Guide


Copyright © 2008 Infor. All rights reserved.
IDO .NET API and Class Library

public string SplashFilename;


public bool UseHtmlHelp;
public bool ValidationErrorIndicators;
public string VBAFilename;
public string Version;
public string VertComponentSpacing;
public string WallpaperDisplayOption;
public string WallpaperFilename;
public bool XPVisualStyle;

The following configuration/application properties (encrypted strings) are available through


the ConnectionProfile class:
public string ConnectionKey
public string DatabaseName
public DatabaseType DatabaseType
public ProviderType DataProvider
public string DataSource
public long DBTimeout
public ProviderDriver Driver
public string MiscConnectionInfo
public string Password
public string ProfileName
public string UserId

IDO Development Guide 2-25


Copyright © 2008 Infor. All rights reserved.
IDO .NET API and Class Library

2-26 IDO Development Guide


Copyright © 2008 Infor. All rights reserved.
3
IDO Extension Classes __________________________
About Extension Classes
An IDO extension class is a .NET class that allows developers to extend the functionality
of an existing IDO by adding methods and event handlers. IDO extension classes are
compiled into a .NET class library assembly and stored in the IDO metadata database. The
IDO runtime loads these assemblies on demand and calls methods and event handlers in
the extension classes in response to IDO requests.
An extension class is short-lived; it is created at the start of a request and disposed of
immediately when the response is completed. Therefore, no state should be stored in an
extension class.
Any public class in an IDO extension class assembly can be identified as the extension
class for an IDO in the IDO metadata database.
IDO extension class assemblies are created from VisualStudio 2005 class library projects.
The projects can use any of the .NET languages; however, all code samples and
procedures described in this document use VB.NET.

Creating a New IDO Extension Class Project


To create a new project:
1. Open VisualStudio 2005 and select File > New > Project from the menu.
2. In the New Project dialog, select Visual Basic for the project type, and select the
Class Library template.
3. Specify a name and location for your project and click OK.
4. The new project will contain a class file named Class1.vb. Right click on the file in the
Solution Explorer and delete it.
5. On the Project menu, select Add Reference.
6. In the Add Reference dialog, click the Browse tab and navigate to the Infor Mongoose
Framework installation directory. Add references to these assemblies:

IDOCore.dll
IDOProtocol.dll
MGShared.dll
7. On the Project menu, select Add New Item.
8. Select Code File, name the new file AssemblyInfo.vb, and click OK.

IDO Development Guide 3-1


Copyright © 2008 Infor. All rights reserved.
IDO Extension Classes

9. Open the new AssemblyInfo.vb source file and add this assembly attribute:
<Assembly: Mongoose.IDO.IDOExtensionClassAssembly("assembly-name")>

Substitute a meaningful name for the assembly-name parameter. This can be anything
but typically is the name of the IDO project associated with the classes in this assembly.
When this class library is imported the IDO Custom Assemblies form, the name you
specify here becomes the name of the assembly.

Importing Assemblies
Use the IDO Custom Assemblies form in Infor ERP SL to import assemblies.
Link the IDO to the custom assembly on the IDOs form by checking out the IDO and
entering the Custom Assembly Name (the Assembly Name from the IDO Custom
Assemblies form), the Ext Class Name (the name of the class - usually the same as the
IDO), and the Ext Class Namespace (usually the same as the Project Name).
Link the methods in the extension class to the IDO by entering the Method Name and
specifying the Parameters list on the IDO Methods form. The Method Type will be
Handcoded - Standard Method or Handcoded - Custom Load Method.

Implementing an IDO Extension Class


Mongoose.IDO.IIDOExtensionClass Interface
In order for an extension class to access the calling user's context (session information,
databases, and so forth), the extension class should implement the IIDOExtensionClass
interface in the Mongoose.IDO namespace.
Public Interface IIDOExtensionClass
Sub SetContext( _
ByVal context As Mongoose.IDO.IIDOExtensionClassContext)
End Interface

Mongoose.IDO.IIDOExtensionClassContext Interface
The SetContext method is called once when the extension class is created, passing a
reference to the IIDOExtensionClassContext interface for accessing the calling user's
context.
Public Interface IIDOExtensionClassContext
ReadOnly Property IDO() As Mongoose.IDO.IVirtualIDO
ReadOnly Property Commands() As Mongoose.IDO.IIDOCommandHelper
End Interface

The framework provides a class named Mongoose.IDO.ExtensionClassBase that is


intended to be used as the base class for most typical IDO extension classes. This class
provides a default implementation of the IIDOExtensionClass interface and provides a
number of methods to facilitate calling methods, loading and updating collections, and
other common tasks, which will be covered later.

3-2 IDO Development Guide


Copyright © 2008 Infor. All rights reserved.
IDO Extension Classes

Declaration of an IDO Extension Class for an IDO


When declaring an IDO extension class, you may add the optional IDOExtensionClass
attribute in order to facilitate adding the necessary IDO metadata to associate an extension
class with an IDO. The following sample code shows how to associate an extension class
with the SLJobMats IDO.
<IDOExtensionClass("SLJobtMats")> _
Public Class SLJobtMats
Inherits ExtensionClassBase

' ...Implementation goes here...

End Class

It is generally a good idea to import some common framework namespaces to make your
code less verbose and clearer, and to enable the Explicit and Strict VB compiler options.
IDO Extension Class Starter Template
The following sample code may be used as a template for creating new IDO extension
classes.
Option Explicit On
Option Strict On

Imports Mongoose.IDO
Imports Mongoose.IDO.Protocol
Imports Mongoose.IDO.DataAccess
Imports Mongoose.Core.Common

<IDOExtensionClass("class-name")> _
Public Class class-name
Inherits ExtensionClassBase

' optionally override the SetContext method


'Public Overrides Sub SetContext( _
' ByVal context As IIDOExtensionClassContext)
'
' call base class implementation
' MyBase.SetContext(context)
'
' ' Add event handlers here, for example:
' 'AddHandler _
' ' Me.Context.IDO.PreUpdateCollection, _
' ' AddressOf Me.PreUpdateCollection
'
'End Sub

' ...Implementation goes here...

End Class

IDO Development Guide 3-3


Copyright © 2008 Infor. All rights reserved.
IDO Extension Classes

Adding Methods
In order to call a method on an IDO extension class, the method must be declared as public
and it must also be defined in the IDO metadata as a hand-coded method. This is different
from previous versions of the framework, where the metadata for a method was defined by
convention, using the Do not generate source attribute, but not required.
A hand-coded method may be either a standard method, which is a Function with zero or
more input/output parameters and returns an integer, or a custom load method, which is a
Function with zero or more parameters and returns an instance of either an IDataReader
or a DataTable (see the .NET Framework documentation for information about these).
When implementing a hand-coded method that will be callable through the IDO runtime,
you could add the optional IDOMethod attribute, which may be used in the future to
facilitate adding the necessary IDO metadata to make the method accessible.
Sample Standard Method Call
For example, the declaration of a standard method might look like the following Function
declaration:
<IDOMethod(MethodFlags.None, "Infobar")> _
Public Function DoWork( _
ByVal SessionID As String, _
ByVal TransNum As Long, _
ByRef Infobar As String) As Integer

' ...Implementation goes here...

End Function

IDOMethod Parameters
The IDOMethod attribute takes two optional parameters: flags and messageParm.
Flags
The flags parameter is one or more of the values defined by the MethodFlags
enumeration. This table shows the MethodFlags values:

MethodFlags value Description


None Standard method call.
CustomLoad Custom load method.
RequiresTransaction Method runs in the context of a transaction.

MessageParm
The messageParm parameter is a string and is the name of the parameter that will be used
to return messages to the caller (Infobar). The parameter that is identified should be
declared as a String and passed ByRef.
Remember that these attributes are not used at run time. They may be used in the future
to facilitate adding and synchronizing the IDO metadata for an extension class and its
methods when an assembly is imported.

3-4 IDO Development Guide


Copyright © 2008 Infor. All rights reserved.
IDO Extension Classes

IDO Event Handlers


When an IDO is processing a LoadCollection or UpdateCollection request, it will fire several
events. An IDO extension class can add its own event handlers to these events to get
control when these events are fired.
The available events are:

Event Description
PreLoadCollection Fires when a LoadCollection request is received.
PostLoadCollection Fires after a LoadCollection request has been processed.
PreUpdateCollection Fires when an UpdateCollection request is received.
PostUpdateCollection Fires after an UpdateCollection request has been processed.

Adding an IDO Event Handler


IDO event handler methods should be declared as private "Sub" methods in your VB.Net
IDO extension class. These methods should use the same signature as the following
example:
Private Sub HandlePreLoadCollection( _
ByVal sender As Object, _
ByVal args As IDOEventArgs)

These IDO events are available on the IDO property of the IIDOExtensionClassContext
interface. To add your handler to an IDO event you must override the
ExtensionClassBase.SetContext method in your IDO extension class and use the
AddHandler keyword as shown in the following example.
Public Overrides Sub SetContext( _
ByVal context As IIDOExtensionClassContext)

' call base class implementation


MyBase.SetContext(context)

' Add event handlers here, for example:


AddHandler _
Me.Context.IDO.PreUpdateCollection, _
AddressOf Me.PreUpdateCollection

End Sub

IDO Development Guide 3-5


Copyright © 2008 Infor. All rights reserved.
IDO Extension Classes

Event Handler Parameters


The first parameter on an IDO event handler method is the sender parameter, which is
simply a reference to the IDO that initiated the event. This is equivalent to the
IIDOExtensionClassContext.IDO property.
The second parameter is an instance of the IDOEventArgs class which will allow you to
access the original IDO request that initiated the event, and for the Post events, the IDO
response also.
Public Class IDOEventArgs
Inherits EventArgs

Public ReadOnly Property RequestPayload() As PayloadBase


Public ResponsePayload As PayloadBase
End Class

The following table describes the contents of the IDOEventArgs parameter for each IDO
event.

Event RequestPayload property ResponsePayload field


PreLoadCollection Contains an instance of the Nothing
LoadCollectionRequestData class
that the IDO is processing
PostLoadCollection Contains an instance of the Contains an instance of the
LoadCollectionRequestData class LoadCollectionResponseData
that the IDO processed. class that will be returned to
the caller.
PreUpdateCollection Contains an instance of the Nothing
UpdateCollectionRequestData class
that the IDO is processing
PostUpdateCollection Contains an instance of the Contains an instance of the
UpdateCollectionRequestData class UpdateCollectionResponseDat
that the IDO processed. a class that will be returned to
the caller.

An event handler method can access the IDO request and response payloads as shown in
the following examples.
Private Sub HandlePreLoadCollection( _
ByVal sender As Object, _
ByVal args As IDOEventArgs)

' Get the original request


Dim loadRequest As LoadCollectionRequestData

loadRequest = CType(args.RequestPayload,
LoadCollectionRequestData)
' ...additional logic based on loadRequest...

End Sub

3-6 IDO Development Guide


Copyright © 2008 Infor. All rights reserved.
IDO Extension Classes

Private Sub HandlePostLoadCollection( _


ByVal sender As Object, _
ByVal args As IDOEventArgs)

' Get the original request


Dim loadRequest As LoadCollectionRequestData
Dim loadResponse As LoadCollectionResponseData

loadRequest = CType(args.RequestPayload,
LoadCollectionRequestData)
loadResponse = CType(args.ResponsePayload,
LoadCollectionResponseData)
' ...additional logic based on loadRequest or loadResponse...

End Sub

Private Sub HandlePreUpdateCollection( _


ByVal sender As Object, _
ByVal args As IDOEventArgs)

' Get the original request


Dim updateRequest As UpdateCollectionRequestData

updateRequest = CType(args.RequestPayload,
UpdateCollectionRequestData)
' ...additional logic based on updateRequest...

End Sub

Private Sub HandlePostUpdateCollection( _


ByVal sender As Object, _
ByVal args As IDOEventArgs)

' Get the original request


Dim updateRequest As UpdateCollectionRequestData
Dim updateResponse As UpdateCollectionResponseData

updateRequest = CType(args.RequestPayload,
UpdateCollectionRequestData)
updateResponse = CType(args.ResponsePayload,
UpdateCollectionResponseData)
' ...additional logic based on loadRequest or loadResponse...

End Sub

IDO Development Guide 3-7


Copyright © 2008 Infor. All rights reserved.
IDO Extension Classes

Special Cases for UpdateCollection Events


There are special cases when an IDO UpdateCollection request may not process all items
in the update. For example, this may happen when a caller is saving hierarchical data,
which is represented as an UpdateCollection request with nested UpdateCollection child
requests. The framework will first process only the deleted items in the child requests, then
all items in the parent, followed by the inserted or updated items in the child requests. The
following example shows how an event handler can determine if the framework is
processing inserted, update and/or deleted items.
Private Sub HandlePostUpdateCollection( _
ByVal sender As Object, _
ByVal args As IDOEventArgs)

' Get the original request


Dim updateRequest As UpdateCollectionRequestData
Dim updateResponse As UpdateCollectionResponseData
Dim updateArgs As IDOUpdateEventArgs

updateArgs = CType(args, IDOUpdateEventArgs)


updateRequest = CType(args.RequestPayload,
UpdateCollectionRequestData)
updateResponse = CType(args.ResponsePayload,
UpdateCollectionResponseData)

If (updateArgs.ActionMask And UpdateAction.Delete) =


UpdateAction.Delete Then
' ...only perform this logic if processing deleted items...
End If

If (updateArgs.ActionMask And UpdateAction.Insert) =


UpdateAction.Insert Then
' ...only perform this logic if processing inserted items...
End If

If (updateArgs.ActionMask And UpdateAction.Update) =


UpdateAction.Update Then
' ...only perform this logic if processing updated items...
End If

' ...additional logic based on loadRequest or loadResponse...

End Sub

3-8 IDO Development Guide


Copyright © 2008 Infor. All rights reserved.
IDO Extension Classes

Using the ActionMask Property


In the example above, the IDOUpdateEventArgs class inherits from IDOEventArgs, but has
one additional property: ActionMask. The ActionMask is declared as an UpdateAction,
which is an enum (shown below).
public enum UpdateAction : ushort
{
None = (ushort)0x0000,
Insert = (ushort)0x0001,
Update = (ushort)0x0002,
Delete = (ushort)0x0004,
All = (ushort)0xffff
}

The ActionMask is usually a combination of Insert, Update and Delete (All), meaning the
UpdateCollection that was just performed executed all types of actions.
However, there are certain circumstances when this may be a subset of Insert, Update and
Delete, which means only the items that match the mask were actually saved. There are
times when the IDO runtime must save items in a particular order (with nested updates),
and it may first process only deleted items; then in another pass it will execute all inserts
and updates.
ActionMask is valid for both Pre- and PostUpdateCollection. The PreUpdateCollection
parameters are the same as the PostUpdateCollection parameters – but the action
indicates which items are about to be saved, rather than which items were just saved.
Replacing Standard IDO Processing with Event Handlers
By adding event handlers, not only can you perform additional logic when a particular event
fires, but in the case of PreUpdateCollection and PreLoadCollection you can also
completely replace the default framework implementation by constructing your own
response and setting that in the IDOEventArgs.ResponsePayload field. The following
example shows how this is done for an UpdateCollection request.
Private Sub HandlePreUpdateCollection( _
ByVal sender As Object, _
ByVal args As IDOEventArgs)

' Get the original request


Dim updateRequest As UpdateCollectionRequestData
Dim updateResponse As UpdateCollectionResponseData

updateRequest = CType(args.RequestPayload,
UpdateCollectionRequestData)

updateResponse = New UpdateCollectionResponseData(updateRequest)


' ...process items in the request, filling in the response...

' override the standard processing, returning my


' custom response instead:
args.ResponsePayload = updateResponse

End Sub

IDO Development Guide 3-9


Copyright © 2008 Infor. All rights reserved.
IDO Extension Classes

Generating Application Events


The ExtensionClassBase class provides a method named FireApplicationEvent that may
be used to generate an application event.
Protected Function FireApplicationEvent( _
ByVal eventName As String, _
ByVal sychronous As Boolean, _
ByVal transactional As Boolean, _
ByRef result As String, _
ByRef parameters As ApplicationEventParameter()) As Boolean

Properties
Property Description
eventName The name of the event to generate
synchronous Determines if the event handlers should be executed
synchronously (True) or asynchronously (False).
transactional Determines if the event handlers should be executed in a
transaction. If passed as False and one of the synchronous
handlers fails, any database activity performed by prior
handlers will remain committed.
result The value of the last RESULT() keyword executed on a Finish
or Fail action on any handler.
parameters An array of named parameters passed to the event handlers.

Example
Option Explicit On
Option Strict On

Imports Mongoose.IDO
Imports Mongoose.IDO.Protocol
Imports Mongoose.IDO.DataAccess
Imports Mongoose.Core.Common

<IDOExtensionClass("MyIDO")> _
Public Class TestFiringEvent
Inherits ExtensionClassBase

<IDOMethod(MethodFlags.None, "Infobar")> _
Public Function FireMyEvent( _
ByVal Parm1 As String, _
ByVal Parm2 As Long, _
ByRef Infobar As String) As Integer

Dim ParmList(1) As ApplicationEventParameter


Dim result As String

ParmList(0) = New ApplicationEventParameter()


ParmList(0).Name = "PString"
ParmList(0).Value = Parm1
ParmList(1) = New ApplicationEventParameter()
ParmList(1).Name = "PNumeric"
ParmList(1).Value = Parm2.ToString()

3-10 IDO Development Guide


Copyright © 2008 Infor. All rights reserved.
IDO Extension Classes

If Not FireApplicationEvent("MyEvent", True, True, _


result, ParmList) Then
Infobar = result
End If

End Function
End Class

Code Samples
The examples in this section assume you are writing code in an IDO extension
class that inherits from the Mongoose.IDO.ExtensionClassBase class.

LoadCollection Examples
The following sample code demonstrates executing a LoadCollection for the
SLTtJobtMatPosts IDO, bringing back the TransNum and TransSeq properties.
Dim loadResponse As LoadCollectionResponseData

loadResponse = Me.Context.Commands.LoadCollection( _
"SLTtJobtMatPosts", _
"TransNum,TransSeq", _
filter, String.Empty, 0)

The following sample demonstrates executing a LoadCollection for the IDO that the
extension class belongs to (the current instance of the executing IDO).
Dim loadResponse As LoadCollectionResponseData

loadResponse = Me.LoadCollection( _
"TransNum, EmpNum, EmpEmpType, EmpDept, DerJobPWcDept ", _
filter, _
"Posted, LowLevel DESC, Job, Suffix, CloseJob, TransNum", _
0)

The following sample demonstrates one way to iterate through items in a


LoadCollectionResponseData instance returned from a LoadCollection request, and
how to access property values.
Dim empNum As String

For index As Integer = 0 To loadResponse.Items.Count


If Not loadResponse(index, "EmpNum").IsNull Then
empNum = loadResponse(index, "EmpNum").Value
' ...processing...
End If
Next

IDO Development Guide 3-11


Copyright © 2008 Infor. All rights reserved.
IDO Extension Classes

UpdateCollection Examples
Inserting a New Item
The following sample demonstrates inserting a new item.
Dim request As New UpdateCollectionRequestData
Dim response As New UpdateCollectionResponseData
Dim customerItem As New IDOUpdateItem

request.IDOName = "SLCustomers"
request.RefreshAfterUpdate = True

customerItem.Action = UpdateAction.Insert
customerItem.Properties.Add("CoNum", "C000100")
customerItem.Properties.Add("Name", "New Company")
customerItem.Properties.Add("CreditHold", 1I)

request.Items.Add(customerItem)
response = Me.Context.Commands.UpdateCollection(request)

Updating an Existing Item


The following sample demonstrates updating an existing item queried through a
LoadCollection request.
Dim loadResponse As New LoadCollectionResponseData
Dim request As New UpdateCollectionRequestData
Dim response As New UpdateCollectionResponseData
Dim customerItem As New IDOUpdateItem

loadResponse = Me.Context.Commands.LoadCollection( _
"SLCustomers", _
"CoNum, Name, CreditHold", _
"CoNum = N'C000100'", _
"", _
1)

If loadResponse.Items.Count = 1 Then
request.IDOName = "SLCustomers"
request.RefreshAfterUpdate = True

' must have the ItemID to update or delete


customerItem.ItemID = loadResponse.Items(0).ItemID
customerItem.Action = UpdateAction.Update
customerItem.Properties.Add("CreditHold", 0I)

request.Items.Add(customerItem)
response = Me.Context.Commands.UpdateCollection(request)
End If

3-12 IDO Development Guide


Copyright © 2008 Infor. All rights reserved.
IDO Extension Classes

Invoke Example
The following sample demonstrates invoking the JobtClsLogErrorSp method on the
SLJobtCls IDO, passing two parameters and retrieving the output value for the second
parameter.
Dim invokeResponse As New InvokeResponseData
Dim message As String

invokeResponse = Me.Context.Commands.Invoke( _
"SLJobtCls", _
"JobtClsLogErrorSp", _
TransNum, IDONull.Value)
message = invokeResponse.Parameters(1).Value

IDO Development Guide 3-13


Copyright © 2008 Infor. All rights reserved.
IDO Extension Classes

AppDB Class
The AppDB class, part of the Mongoose.IDO.DataAccess namespace, provides direct
access to the application database, plus access to common framework features such as
application messages and session variables. You may create a new instance of this class
by calling the CreateAppDB method, which is implemented by the ExtensionClassBase
class.
Application Database Connections
In general, the best practice for accessing the database to execute queries, updates or
stored procedure calls is to go through the Infor framework using IDO requests. However,
there may be times when it is necessary or more efficient to access the database directly
(for example, building and executing dynamic SQL or iterating through records from an
extremely large query result set). Direct database access is accomplished using the
standard .NET Framework SQL Server classes: SqlConnection and SqlCommand. See
the Microsoft .NET Framework documentation for more information on these classes.
Opening a Connection to the Application SQL Server Database
The AppDB.Connection property provides an opened SqlConnection instance pointing
to the application database. By going through the AppDB.Connection property, the
framework is able to open and initialize the connection based on the calling user's session
information.
Executing SQL Server Commands
The SqlCommand class is used to execute stored procedures, queries, updates, or any
other T-SQL command. The SqlCommand may be created by using the VB New operator
and setting the necessary properties on the command, as described in the .NET
Framework documentation. However, when the command is executed, you should use the
AppDB.ExecuteScalar, AppDB.ExecuteNonQuery, or AppDB.ExecuteReader
methods. This allows you to leverage the framework infrastructure for executing SQL
commands including logging and exception-message translation.
Application Messages
Access to translatable strings and messages stored in the application database message
tables is implemented by the AppDB class. The strings and messages that are returned
are queried and constructed according to the calling session's regional settings. Access is
provided through the IMessageProvider interface and makes use of application database
messaging stored procedures such as MsgAppSp.
The following methods are published by the IMessageProvider interface:

Method Description
Public Function GetMessage( _ Get a string or message by message ID.
msgID As String ) As String
Public Function GetMessage( _ Get a string or message by message ID
msgID As String, _ with substitution parameters.
ParamArray args() As Object ) _
As String
Public Function AppendMessage( _ Append a string or message by message
message As String, _ ID.
msgID As String ) As String
Public Function AppendMessage ( _ Append a string or message by message
message As String, _ ID with substitution parameters.
msgID As String, _
ParamArray args() As Object ) _
As String

3-14 IDO Development Guide


Copyright © 2008 Infor. All rights reserved.
IDO Extension Classes

Method Description
Public Function GetErrorMessage( _ Get a constraint error message by object
objectName As String, _ name and type.
messageType As AppMessageType ) _
As String
Public Function GetErrorMessage( _ Get a constraint error message by object
objectName As String, _ name and type with substitution
messageType As AppMessageType, _ parameters.
ParamArray args() As Object ) _
As String

Message Lookup Using the AppDB Class


The following example shows how to use the AppDB class to retrieve messages.
Dim messageProvider As IMessageProvider = Nothing

Using appDB As AppDB = Me.CreateAppDB()


messageProvider = appDB.GetMessageProvider()

Infobar = messageProvider.AppendMessage( _
Infobar, _
"I=CmdMustPerform", _
"@:PostPendingMaterialTransactions")
End Using

If you are writing code in an extension class method for a class that derives from
ExtensionClassBase, you can simply call the
ExtensionClassBase.GetMessageProvider method as a shortcut to getting a reference
to the IMessageProvider interface, as shown in this example:
Dim messageProvider As IMessageProvider = Nothing

messageProvider = Me.GetMessageProvider()

Session Variables
The AppDB class publishes the following methods for manipulating session variables for
the caller's session.

Method Description
Public Sub SetSessionVariable( _ Set the value of a session variable.
ByVal name As String, _
ByVal varValue As String )
Public Function GetSessionVariable( _ Get the value of a session variable.
ByVal name As String ) As String
Public Function GetSessionVariable( _ Get the value of a session variable,
ByVal name As String, _ returning the specified default value if it
ByVal defaultValue As String ) _ does not exist.
As String
Public Function GetSessionVariable( _ Get the value of a session variable,
ByVal name As String, _ returning the specified default value if it
ByVal defaultValue As String, _ does not exist, and delete it if it does exist.
ByVal delete As Boolean ) As String
Public Sub DeleteSessionVariable( _ Delete a session variable.
ByVal name As String )

IDO Development Guide 3-15


Copyright © 2008 Infor. All rights reserved.
IDO Extension Classes

Using AppDB in an Extension Class Method


The following example shows how to use AppDB in an extension class.
Public Function MyMethod() As Integer

Using appDB As AppDB = Me.CreateAppDB()


' ...use appDB here...
End Using

End Function

Note that the AppDB instance is created as part of the Using…End Using block. This
ensures that the AppDB instance will be disposed and any resources it is holding will be
released as soon as the instance goes out of scope. See the .NET Framework
documentation for more information on the Using statement.

Disposing of IDO Extension Classes


If an IDO extension class implements the IDisposable interface, the Dispose method will
be called by the IDO runtime when it is finished with each instance. The
ExtensionClassBase class implements IDisposable and provides a virtual method which
you can override in a derived class to get control when an instance is disposed.
protected virtual void Dispose( bool disposing );

See the .NET Framework documentation for more information on the IDisposable
interface.

Translation/Localization Considerations
Type Conversions
The built-in VB functions for data type conversions (CStr, CDate, CInt, etc.) are sensitive
to the regional settings for the application or local machine, and therefore should not be
used for type conversions in IDO extension class methods.
The framework stores all property values internally as strings regardless of their data type.
In WinStudio, this is also true for values stored in components, variables and IDO
collections. The internal string format is culture independent so the built-in string
conversion functions may not work, or may work inconsistently depending on the data or
the current culture settings. The internal formatted string value is always available, but
when accessing numeric, date or Guid property values programmatically, you should use
the APIs provided by the framework that will convert the values from internal string format
to the proper “strong” data types.
IDORequest/Response Property Values (IDOProtocol classes)
Property values in IDO Request and Response classes are represented using the
Mongoose.IDO.Protocol.IDOValueType class, or a class that inherits from this class.
The following example accesses properties in a LoadCollectionResponseData instance:
Dim responseData As LoadCollectionResponseData
Dim name As String
Dim recordDate As DateTime
Dim cost As Decimal
Dim newCost As Decimal = 100.00
Dim id As Guid

3-16 IDO Development Guide


Copyright © 2008 Infor. All rights reserved.
IDO Extension Classes

'…perform LoadCollection…

name = responseData(0, "Name").Value ' access internal value for


strings
recordDate = responseData(0, "RecordDate").GetValue(Of DateTime)() '
convert internal date to DateTime
cost = responseData(0, "Cost").GetValue(Of Decimal)(0.00) ' convert to
Decimal, specifying default if property is null
id = responseData(0, "ID").GetValue(Of Guid)()

responseData(0, "Cost").SetValue( newCost ) ' assign a new value to


cost

Note that the name property simply gets the internal format, since string values do not need
conversion. Also note that the GetValue call for the cost property specifies an optional
default value to return if the property is null. You can also check for null values using the
IsNull property.
The last line assigns a new value to the cost property. Passing in a decimal value to the
SetValue method allows the framework to perform the conversion to the internal string
format automatically.
Converting Internal Format Strings to Strong Typed Variables
WinStudio supports a similar set of methods for automatically converting internal format
strings to strong typed variables in scripts, as shown in the following example.
Dim name As String
Dim recordDate As DateTime
Dim cost As Decimal
Dim newCost As Decimal = 100.00
Dim id As Guid

' …perform LoadCollection…

name = ThisForm.Components("NameEdit").Value ' access internal value


for strings
recordDate =
ThisForm.Components("DateTimeEdit").GetValueOfDateTime(DateTime.Now)
cost =
ThisForm.PrimaryIDOCollection(0).Properties("Cost").GetValueOfDecimal(
0.0)
id = ThisForm.Variables("IDVar").GetValueOfGuid(Guid.Empty)

ThisForm.PrimaryIDOCollection(0).Properties("Cost").SetValue(newCost)

Note that there are individual methods for each data type, instead of a single generic
method that is supported in the IDOProtocol classes. Also, the methods all require a
default value to return if the requested value is null.
Again, the last line assigns a new value to the cost property. Passing in a decimal value to
the SetValue method allows the framework to perform the conversion to the internal string
format automatically

IDO Development Guide 3-17


Copyright © 2008 Infor. All rights reserved.
IDO Extension Classes

Testing Extension Class Assemblies Locally


To test a new version of an extension class assembly locally before checking it in, copy the
new version of the extension class assembly to a folder named syteline/idoxca/config-
name, where syteline is the SyteLine root folder (usually c:\program files\Infor\SyteLine)
and config-name is the configuration you will be logging into to test the DLL.
The IDO runtime checks this location first when it loads an assembly.
This may also be useful to developers working on different classes in the same assembly,
since only one developer can have an assembly checked out at a time.
You may need to discard the IDO metadata cache to force the IDO runtime to load the new
version.

Debugging Extension Classes


IDO extension class code can be debugged using the Visual Studio 2005 debugger. In
order to debug an extension class, the developer must:
1. Build a debug version of the extension class assembly.
2. Import the assembly (DLL) and the symbols (PDB) into the objects database using the
IDO Custom Assemblies form (first checking out the assembly, if it has been checked
in).
3. Run the IDO Runtime Development Server (IDORuntimeHost.exe) on the developer's
local machine. Alternatively, you may use the technique described in “Testing
Extension Class Assemblies Locally” on page 3-18.
4. Run WinStudio configured to access the IDO runtime on the local machine.
5. Open Visual Studio 2005 and select Attach to Process from the Debug menu.
6. Select IDORuntimeHost.exe in the list of available processes and click the Attach
button.

3-18 IDO Development Guide


Copyright © 2008 Infor. All rights reserved.
IDO Extension Classes

You should now be able to set breakpoints in the Visual Studio 2005 debugger and step
through code.
Logging Diagnostic Messages
IDO extension class methods can send messages to the common logging facility IDO
Runtime Development Server (IDORuntimeHost.exe) by calling one of the overloaded
IDORuntime.LogUserMessage methods. For more information about the facility, see
“Diagnostics and Debugging” on page 2-19.
Example
This sample sends a message to the log each time the ValidateCreditCard method is
called.
• The first parameter is messageSource (String). This is the source identifier that will
display in the log viewer.
• The second parameter is messageType (Mongose.IDO.UserDefinedMessageType).
This is the type identifier that will display in the log viewer.
• The third parameter is message (String). This is the text of the message to be logged.

IDO Development Guide 3-19


Copyright © 2008 Infor. All rights reserved.
IDO Extension Classes

<IDOMethod(MethodFlags.None, "infobar")> _
Public Function ValidateCreditCard( _
ByVal cardNumber As String, _
ByVal expires As DateTime, _
ByVal amount As Decimal, _
ByVal infobar As String) As Integer

Dim result As Integer = 0

' Call web service to validate CC info


IDORuntime.LogUserMessage( _
"MyExtensionClass", _
UserDefinedMessageType.UserDefined0, _
"ValidateCreditCard called by user " & IDORuntime.Context.UserName)

Return result
End Function

3-20 IDO Development Guide


Copyright © 2008 Infor. All rights reserved.
Index ____________________________________________

Symbols Data types, supported 2-17


.NET CLR data types 2-14 Database, connecting to 3-14
.NET data types supported by IDO protocol classes 2-17 DatabaseName 2-25
DatabaseType 2-25
A DataProvider 2-25
ActionMask 3-9 DataSource 2-25
ActiveScriptingOnly 2-21, 2-24 DataTable 3-4
Add method 2-14 Date values, format 2-14
AddHandler keyword 3-5 DBTimeout 2-25
AppDB class 2-2, 3-14 Debug menu 3-18
AppDB class, using in extension class method 3-16 Debugging 2-19
AppDB.Connection 3-14 Debugging extension classes 3-18
AppDB.ExecuteNonQuery 3-14 Declaring an IDO extension class 3-3
AppDB.ExecuteReader 3-14 DefFormBGColor 2-22, 2-24
AppDB.ExecuteScalar 3-14 DefFormFGColor 2-22, 2-24
Application database connections 3-14 DefFormFont 2-22, 2-24
Application messages, accessing 3-14 DefNormalBGColor 2-22, 2-24
Application property 2-24 DefNormalFGColor 2-22, 2-24
AppName property 2-22, 2-24 DefReadOnlyBGColor 2-22, 2-24
AppProperties class 2-24 DefReadOnlyFGColor 2-22, 2-24
AppURL 2-22 DefRequiredBGColor 2-22, 2-24
Attach to Process 3-18 DefRequiredFGColor 2-22, 2-24
DefTbdBGColor 2-22, 2-24
B DefTbdFGColor 2-22, 2-24
Base class 3-2 DeleteExistingPrompt 2-22, 2-24
BaseHelpFile 2-22, 2-24 DeleteNewPrompt 2-22, 2-24
DeleteSessionVariable 3-15
C Diagnostic messages, logging 2-19, 3-19
Client class 2-1 DisableInvalidValuePrompt 2-22, 2-24
CloseSession method 2-1, 2-20 Dispose method 3-16
CollectionID property 2-9 Disposing of extension classes 3-16
ColSecurityPrimaryOnly 2-22, 2-24 Distinct property 2-6
CompanyName 2-22, 2-24
ConfigName property 2-24 E
ConfigServer.aspx page 2-20 Event handlers 3-5
Configuration class 2-24 Event handlers, replacing standard IDO processing 3-9
Configuration information 2-23 Events available fo extension classes 3-5
Configuration information storage 2-20 Events, generating 3-10
ConfigurationInfo class, examples 2-21 Examples, syntax of 2-5
ConnectionKey 2-25 Extension class 3-1
ConnectionProfile class 2-25 Debugging 3-18
ConnectionRoles 2-24 Disposing of 3-16
Conversions of data types 2-14 Examples 3-11
Copyright 2-22, 2-24 Project, creating 3-1
CreateAppDB method 3-14 Testing assemblies locally 3-18
Custom assemblies, importing 3-2 ExtensionClassBase class 3-2, 3-14
CustomDelete property 2-9 ExtensionClassBase.SetContext method 3-5
CustomInsert property 2-9 External applications 2-20
CustomLoadMethod property 2-6
CustomUpdate property 2-9 F
Filter strings. creating 2-16
D FireApplicationEvent method 3-10
Data type conversions 2-14 Flags parameter 3-4
Data type conversions in IDO extension classes 3-16 FormCLSID 2-22, 2-24

IDO Development Guide Index-1


Copyright © 2008 Infor. All rights reserved.
Index

FormControlSSEnabled 2-24 Invoke examples 2-11, 3-13


FormFileExtension 2-22, 2-24 IsNull property 2-13, 3-17
FormsURL 2-22 Item, inserting new - example 3-12
Function 3-4 Item, updating existing - example 3-12
Items property 2-9
G
Get parameter and property values 2-15 L
GetConfigurations 2-1 LinkBy property 2-6, 2-9
GetConfigurations static method 2-20 LoadCap property 2-7
GetMessageProvider method 3-15 LoadCollection 2-1, 2-6, 2-16, 3-11
GetPropertyInfo 2-5 LoadCollection examples 2-7
GetSessionVariable 3-15 LoadCollectionRequestData class 2-1
GetValue call 3-17 Localization 2-14, 3-16
GetValue methods 2-15 Logging diagnostic messages 2-19
Logging into a session 2-20
H Logging out of a session 2-20
HelpBasePath 2-22, 2-24 LoginOverrideProgID 2-22, 2-24
HelpContentsIndexMenuText 2-22, 2-24 LogUserMessage method 3-19
HorzComponentSpacing 2-22, 2-24 Look up application messages 3-15
I M
IconFilename 2-22, 2-24 Me.Context.Commands property 2-1
IDataReader 3-4 Message lookup 3-15
IDisposable interface 3-16 MessageParm parameter 3-4
IDO Messages, accessing 3-14
Commands interface 2-1, 2-2 MethodFlags enumeration 3-4
Definition of 2-1 MethodName property 2-11
Protocol class library 2-1 Methods, adding in extension class 3-4
Runtime Development Server 2-19 MGShared.dll 2-20, 2-23, 3-1
IDO Custom Assemblies form 3-2, 3-18 MiscConnectionInfo 2-25
IDO Methods form 3-2 Mongoose.Core.Common 2-23
IDO Runtime Development Server 3-18 Mongoose.Core.Configuration 2-23
IDO Runtime Service 2-20 Mongoose.IDO namespace 3-2
IDOCore.dll 3-1 Mongoose.IDO.Client class 2-1
IDOEventArgs class 3-6 Mongoose.IDO.DataAccess namespace 2-2, 3-14
IDOMethod attribute 3-4 Mongoose.IDO.Protocol namespace 2-1
IDOName property 2-5, 2-6, 2-9, 2-11 MongooseConfigs class 2-23
IDONull.IsNull static method 2-13 MongooseConfigs.xml 2-20
IDONull.Value static property 2-13 MsgAppSp 3-14
IDOProtocol.dll 2-20, 3-1 msgID 3-14
IDORequest class 2-1
IDORequestClient .NET class library 2-1 N
IDORequestClient.dll 2-20 Name property 2-22
IDORequestEnvelope class 2-1 NestedRequests property 2-7
IDORequestService ASP.NET Web server 2-20 Null values, assigning and checking 2-13
IDORuntimeHost.exe 2-19, 2-20, 3-18 Nullable values, in GetValue method 2-15
IDOs form 3-2 Numeric values, format 2-14
IDOValueType class 3-16
IIDOCommands interface (shown in C#) 2-3 O
IIDOCommands interface (shown in VB) 2-4 ObjectMenuName 2-22, 2-24
IIDOExtensionClass interface 3-2 ObjectStudioProjBuildDir 2-24
IIDOExtensionClassContext interface 3-5 ObjectStudioSSEnabled 2-24
IMessageProvider interface 3-14 OpenSession 2-1
Importing assemblies 3-2 OpenSessionRequestData class 2-1
IncludeClassNotesFlag property 2-5 OrderBy property 2-6
Internal format strings, converting to strong typed
variables 3-17
P
Invoke 2-1, 2-11 Parameter values
Invoke call execution, sample steps 2-2 Retrieving 2-15
Setting 2-14

Index-2 IDO Development Guide


Copyright © 2008 Infor. All rights reserved.
Index

Parameters property 2-11 SSPassword 2-24


Password 2-25 SSProjectName 2-24
payload 2-1 SSUNCPath 2-24
Posting a batch of records 2-18 SSUserId 2-24
PostLoadCollection event 3-5, 3-6 Standalone application communications 2-20
PostQueryCommand property 2-6 Standard Method Cal 3-4
PostUpdateCollection event 3-5, 3-6 Strong typed variables 3-17
PreLoadCollection event 3-5, 3-6 System.DateTime, use with SqlLiteral.Format 2-17
PreUpdateCollection event 3-5, 3-6 System.Decimal, use with SqlLiteral.Format 2-17
PrimaryCacheUsesFormCaption 2-22, 2-24 System.Guid, use with SqlLiteral.Format 2-17
ProfileName 2-25 System.Int32, use with SqlLiteral.Format 2-17
ProgIDRootAugment 2-22, 2-24 System.String, use with SqlLiteral.Format 2-17
Property values 3-16
Retrieving 2-15 T
Setting 2-14 Template for new IDO extension classes 3-3
PropertyList property 2-6 Testing extension class assemblies 3-18
ProviderDriver 2-25 Transaction, executing requests in 2-18
Translation 2-14, 3-16
R
ReadMode property 2-6 U
RecordCap property 2-6 UpdateCollection 2-1, 2-9, 3-12
RefreshAfterUpdate property 2-9 UpdateCollection events, special cases 3-8
Regional settings 2-14 UpdateCollection example 2-9
RelFormServerURL 2-24 UseHtmlHelp 2-22, 2-25
RelWebServerURL 2-24 UserId 2-25
ReportViewerExecutable 2-22, 2-24
ReportViewerExecutablePath 2-22, 2-24
V
RightJustifyNewLabels 2-22, 2-24 ValidationErrorIndicators 2-22, 2-25
RSDAO COM library 2-1 VBAFilename 2-22, 2-25
Version 2-22, 2-25
S VertComponentSpacing 2-22, 2-25
Sender parameter on event handler method 3-6
Session variables, manipulating 3-15
W
SetContext method 3-2 WallpaperDisplayOption 2-22, 2-25
SetSessionVariable 3-15 WallpaperFilename 2-22, 2-25
SetValue method 2-14 Web server application 2-20
SplashFilename 2-22, 2-25 WHERE clause 2-16
SQL commands, executing 3-14 Wire Tap feature for debugging 2-19
SqlCommand class 3-14 X
SqlConnection instance 3-14
XPVisualStyle 2-22, 2-25
SqlLiteral class 2-16
SqlLiteral.Format method 2-16

IDO Development Guide Index-3


Copyright © 2008 Infor. All rights reserved.

Вам также может понравиться