Repository navigation
UserGuide_IndividualFunctions
This is a English page.
Click here for Japanese version of this file.
Updated in July 2026
- SEs and developers who develop applications with Open Touryo
This document summarizes how to use each function of the framework.
Company names and product names in this document are trademarks or registered trademarks of their respective companies.
※ For details of the APIs and XML definitions, see the attached "User API list.xls", "API reference manual.zip" and the original materials.
2. Child screen display function
3. Shared information and message acquisition functions
4. Screen transition control function
5. Transaction control function
6. Communication control function
This chapter describes the common APIs implemented by each namespace. For an overview, see the attached "User API list.xls" and "API reference manual.zip".
Table 1.1 Common APIs of the Public namespace (main classes / methods)
| Function | Class | Main methods |
|---|---|---|
| Reading files | ResourceLoader / EmbeddedResourceLoader | Reading files / embedded resources |
| Log output processing | LogIF | DebugLog, InfoLog, WarnLog, ErrorLog, FatalLog |
| Getting parameters from the config | GetConfigParameter | GetConfigValue (appSettings), GetConnectionString (connectionStrings) |
| Encoding processing | CustomEncode [1] | StringToByte, ByteToString, HtmlEncode [2], UrlEncode [3], ToBase64String, FromBase64String |
| JIS2004 check processing | JIS2k4Checker | CheckSurrogatesPairChar, DeleteSurrogatesPairChar, CheckCharAddedWithJIS2k4, DeleteCharAddedWithJIS2k4 |
| String editing processing | StringConverter / StringChecker / FormatConverter / FormatChecker | Full-width / half-width and katakana / hiragana conversion, various checks, Gregorian / Japanese era conversion, postal code and phone number checks, etc. |
Table 1.2-1 Common APIs of the Framework namespace - P layer framework (main methods)
| Function | Class | Overview / category | Main methods |
|---|---|---|---|
| Child screen display function [4] | BaseController | Displaying message dialogs | ShowOKMessageDialog, ShowYesNoMessageDialog |
| Implementing post-processing of Yes/No message dialogs | UOC_YesNoDialog_X/Yes/No_Click | ||
| Displaying business modal dialogs | ShowModalScreen, GetScriptToShowModalScreen | ||
| Closing business modal dialogs | CloseModalScreen(_NoPostback/_WithAllParent) | ||
| Implementing post-processing of business modal dialogs | UOC_ModalDialog_End | ||
| Displaying business modeless dialogs | ShowNormalScreen, GetScriptToShowNormalScreen | ||
| Session management function [5] | BaseController | Session areas per parent screen (of business modal dialogs) | SetDataToModalInterface, GetDataFromModalInterface, DeleteDataFromModalInterface |
| Session areas per browser window | SetDataToBrowserWindow, GetDataFromBrowserWindow, DeleteDataFromBrowserWindow | ||
| Session areas per subsystem ID | SetSubsysInformation, GetSubsysInformation, DeleteSubsysInformation | ||
| Session areas for user information | SetUserInformation, GetUserInformation, DeleteUserInformation | ||
| Screen transition function | BaseController | When not using the screen transition control function | FxTransfer (Server.Transfer), FxRedirect (Response.Redirect) |
| When using the screen transition control function | ScreenTransition (method), TransitionMethod (ON/OFF property) | ||
| Others | BaseController | Utility methods for getting controls | GetFxWebControl, GetMasterWebControl, GetContentWebControl |
| Utility member variables | RootMasterPageFileNoEx, ContentPageFileNoEx, CurrentScriptManager, AjaxExtensionStatus, IsClientCallback |
Table 1.2-2 Common APIs of the Framework namespace - B and D layer frameworks (main methods)
| Function | Class | Overview / category | Main methods |
|---|---|---|---|
| B layer framework | BaseLogic | Dam management | SetDam, GetDam |
| Transaction management … (see chapter 5) | GetTransactionPatterns, InitDam | ||
| D layer framework | BaseDao | Dam management | BaseDao (constructor), GetDam |
| Query setting | SetSqlByFile, SetSqlByFile2, SetSqlByCommand, SetParameter, GetParameter, SetUserParameter | ||
| Data access | ExecSelectFill_DT, ExecSelectFill_DS, ExecSelect_DR, ExecSelectScalar, ExecInsUpDel_NonQuery |
Table 1.2-3 Common APIs of the Framework namespace - others
| Function | Class | Main methods |
|---|---|---|
| Getting shared information (see chapter 3) | GetSharedProperty | GetSharedPropertyValue |
| Getting messages (see chapter 3) | GetMessage | GetMessageDescription |
| Communication control (see chapter 6) client side | CallController | Method: Invoke, properties: Context, ProxyUrl, NetworkCredentialToProxy, NetworkCredentialToWAS |
| Communication control (see chapter 6) server side (service interface) | ASPNETWebService.FxController, WCFService.WCFTCPSvcForFx | - |
The child screen display function of the P layer uses JavaScript functions to launch the child screens prepared by the framework. To prepare the child screens, refer to the implementation of the "OK message dialog" (myOKMessageDialog.aspx(.cs)) and the "YES/NO message dialog" (myYesNoMessageDialog.aspx(.cs)) attached to the samples. If you change the module names, you must change the values of the "FxYesNoMessageDialogPath" and "FxOKMessageDialogPath" parameters in web.config.
- OK message dialog: Call the "ShowOKMessageDialog" method from P layer event processing. Arguments: messageID, message, iconType, dialogName, dialogStyle (optional).
// Display a message
this.ShowOKMessageDialog("message ID", "Message: " + msg,
FxEnum.IconType.INFORMATION, "Dialog display test");
// Display a message (overload)
this.ShowOKMessageDialog("message ID", "Message: " + msg,
FxEnum.IconType.INFORMATION, "Dialog display test",
"dialogWidth:450px;dialogHeight:250px;status:no;");Figure 2.2.1 Displaying an OK message dialog
-
YES/NO message dialog:
- Call the "ShowYesNoMessageDialog" method. Arguments: messageID, message, dialogName, dialogStyle (optional).
// Display a message
this.ShowYesNoMessageDialog(
"message ID", "message",
"Dialog display test");
// Display a message (overload)
this.ShowYesNoMessageDialog(
"message ID", "message",
"Dialog display test", "dialogWidth:640px;dialogHeight:480px;status:no;");- Implement the post-processing corresponding to the [YES], [NO] and [×] buttons by overriding the "UOC_YesNoDialog_Yes/No/X_Click" methods in the "screen code class".
/// <summary>Implements the processing when the "×" of the "YES/NO" message dialog is pressed and the dialog is closed.</summary>
/// <param name="parentFxEventArgs">Common argument of the event handler of the button on the parent screen</param>
protected override void UOC_YesNoDialog_X_Click(FxEventArgs parentFxEventArgs)
{
// Implement the processing when the "×" of the "YES/NO" message dialog is pressed and the dialog is closed
// TODO:
// switch statement
}/// <summary>Implements the processing when "YES" of the "YES/NO" message dialog is pressed and the dialog is closed.</summary>
/// <param name="parentFxEventArgs">Common argument of the event handler of the button on the parent screen</param>
protected override void UOC_YesNoDialog_Yes_Click(FxEventArgs parentFxEventArgs)
{
// Implement the processing when "YES" of the "YES/NO" message dialog is pressed and the dialog is closed
// TODO:
// switch statement
}/// <summary>Implements the processing when "NO" of the "YES/NO" message dialog is pressed and the dialog is closed.</summary>
/// <param name="parentFxEventArgs">Common argument of the event handler of the button on the parent screen</param>
protected override void UOC_YesNoDialog_No_Click(FxEventArgs parentFxEventArgs)
{
// Implement the processing when "NO" of the "YES/NO" message dialog is pressed and the dialog is closed
// TODO:
// switch statement
}- Implement the post-processing by distinguishing the argument "button history information of the parent screen" (
parentFxEventArgs.ButtonID) with a switch statement. Note that if the button history recording function (buttonHistoryRecorder parameter) is set to [off], the value ofparentFxEventArgs.ButtonIDis always "dummy".
// Implementation example of the switch statement: implement code like the following in the switch statement.
switch (parentFxEventArgs.ButtonID)
{
case "btnXXXX":
// Post-processing when the [YES] button of the [YES]/[NO] message dialog opened by the btnXXXX button is pressed
break;
case "btnYYYY":
// Post-processing when the [YES] button of the [YES]/[NO] message dialog opened by the btnYYYY button is pressed
break;
default:
break;
}-
Business modal dialog:
- Use "ShowModalScreen" from server-side events and "GetScriptToShowModalScreen" from client-side events (arguments: screenURL, dialogStyle).
// Display the screen
this.ShowModalScreen("URL");
// Display the screen (overload)
this.ShowModalScreen("URL", "dialogWidth:640px;dialogHeight:480px;status:no;");// Display the screen
this.GetScriptToShowModalScreen("URL");
// Display the screen (overload)
this.GetScriptToShowModalScreen("URL", "dialogWidth:640px;dialogHeight:480px;status:no;");// Without a style specification
this.btnShowModalScreen1.OnClientClick = "return " + this.GetScriptToShowModalScreen("URL") + ";";
// With a style specification
this.btnShowModalScreen2.OnClientClick = "return " + this.GetScriptToShowModalScreen("URL", "STYLE") + ";";- To close, use "CloseModalScreen" or "CloseModalScreen_NoPostback" as appropriate (the behavior after closing differs).
/// <summary>
/// Closes the current screen. When returning to the parent screen,
/// executes a postback and runs the post-processing.
/// </summary>
protected void CloseModalScreen()
/// <summary>
/// Closes the current screen.
/// When returning to the parent screen, does not postback and does not run the post-processing.
/// </summary>
protected void CloseModalScreen_NoPostback()- Implement the post-processing in "UOC_ModalDialog_End".
/// <summary>Implements the post-processing of the business modal screen.</summary>
/// <param name="parentFxEventArgs">Button history of the button (on the parent screen) that opened the business modal screen</param>
/// <param name="childFxEventArgs">Button history of the button (on the child screen, last pressed) that closed the business modal screen</param>
protected override void UOC_ModalDialog_End(FxEventArgs parentFxEventArgs, FxEventArgs childFxEventArgs)
{
// Implement the post-processing of the business modal screen
// TODO:
// switch statement
switch (parentFxEventArgs.ButtonID)
{
case "btnXXXX":
// Of the business modal dialog opened by the btnXXXX button
switch (childFxEventArgs.ButtonID)
{
case "btnAAAA":
// Post-processing when the screen was closed by pressing the btnAAAA button
~
break;
case "btnBBBB":
// Post-processing when the screen was closed by pressing the btnBBBB button
~
break;
~
default:
break;
}
break;
case "btnYYYY":
// Of the business modal dialog opened by the btnYYYY button
switch (childFxEventArgs.ButtonID)
{
case "btnAAAA":
// Post-processing when the screen was closed by pressing the btnAAAA button
~
break;
case "btnBBBB":
// Post-processing when the screen was closed by pressing the btnBBBB button
~
break;
~
default:
break;
}
break;
~
default:
break;
}
}According to the framework specification, the aforementioned "post-processing of YES/NO message dialog display processing" and "post-processing of business modal dialog screen display processing" cannot be implemented in the "common event processing of controls on a master page" of the "screen code parent class 2". This is because the "common event processing of controls on a master page" in the "screen code parent class 2" cannot determine which "master page" or "content page" the "button history" belongs to.
- Business modeless screen: Call the "ShowNormalScreen" method (arguments: screenURL, screenStyle).
// Display the screen
this.ShowNormalScreen("testScreen.aspx");
// Display the screen (overload)
this.ShowNormalScreen("testScreen.aspx", "width=960,height=700;");- Four kinds of methods are used to pass information between the parent screen and the business modal dialog (Figure 2.3). The area that holds the passed information is the "session area per parent screen", so there is no need to consider session duplication (conflicts). Always delete the data after use, or avoid storing large data, to prevent memory leaks.
/// <summary>Set data to pass</summary>
/// <param name="name">Key name</param>
/// <param name="value">Value</param>
protected void SetDataToModalInterface(string name, object value)
/// <summary>Get passed data</summary>
/// <param name="name">Key name</param>
protected object GetDataFromModalInterface(string name)
/// <summary>Delete passed data (per key)</summary>
/// <param name="name">Key name</param>
protected void DeleteDataFromModalInterface(string name)
/// <summary>Delete passed data (all)</summary>
protected void DeleteDataFromModalInterface()- Shared information acquisition function: An optional function in which "keys" and "shared information" are defined in an XML definition file, and the "shared information" is obtained by specifying the "key" from the API.
- Message acquisition function: An optional function in which "message IDs" and "messages" are defined in an XML definition file, and the "message" is obtained by specifying the "message ID" from the API.
-
Shared information acquisition function: Define the key in the key attribute and the shared information in the value attribute of the
SharedProptag.
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE SPD[
<!ELEMENT SPD (SharedProp*)>
<!ELEMENT SharedProp EMPTY>
<!ATTLIST SharedProp
key ID #REQUIRED
value CDATA #REQUIRED>
]>
<!-- key(id) cannot start with a digit. -->
<SPD>
<SharedProp key="ConnectionString1" value="test 1"/>
<SharedProp key="ConnectionString2" value="test 2"/>
<SharedProp key="HostName1" value="test 3"/>
<SharedProp key="HostName2" value="test 4"/>
</SPD>-
Message acquisition function: Define the message ID in the id attribute and the message in the description attribute of the
Messagetag (see the DTD for details of the format).
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE MSGD[
<!ELEMENT MSGD (Message*)>
<!ELEMENT Message EMPTY>
<!ATTLIST Message
id ID #REQUIRED
description CDATA #REQUIRED>
]>
<!-- id cannot start with a digit. -->
<!-- E at the beginning for error cases, I at the beginning for normal cases, etc. -->
<MSGD>
<Message id="E0001" description="~Message description 1 (error)~"/>
<Message id="E0002" description="~Message description 2 (error)~"/>
<Message id="E0003" description="~Message description 3 (error)~"/>
<Message id="E0004" description="~Message description 4 (error)~"/>
<Message id="E0005" description="~Message description 5 (error)~"/>
<Message id="I0001" description="~Message description 1 (normal)~"/>
<Message id="I0002" description="~Message description 2 (normal)~"/>
<Message id="I0003" description="~Message description 3 (normal)~"/>
<Message id="I0004" description="~Message description 4 (normal)~"/>
<Message id="I0005" description="~Message description 5 (normal)~"/>
</MSGD>Figure 3.1 XML definition files
- Shared information acquisition function: Specify the path to the file in the
FxXMLSPDefinitionparameter of app.config.
<!-- Path to the message definition -->
<add key="FxXMLSPDefinition" value="C:\root\files\resource\Xml\SPDefinition.xml"/>- Message acquisition function: Specify the path to the file in the
FxXMLMSGDefinitionparameter of app.config. (Figure 3.2-2)
<!-- Path to the message definition -->
<add key="FxXMLMSGDefinition" value="C:\root\files\resource\Xml\MSGDefinition.xml"/>- When using it on the client side, compile the XML definition file as an embedded resource and specify the file name as "namespace + file name".
<!-- For an embedded resource -->
<add key="FxXMLXXXDefinition" value="(project namespace).XXXDefinition.xml"/>Note that if the FxXMLSPDefinition and FxXMLTMProtocolDefinition parameters are not specified, the XML definition files are initialized with empty data.
- Getting shared information: The "GetSharedPropertyValue" method of the "GetSharedProperty" class.
// Get the message.
string message = GetSharedProperty.GetSharedPropertyValue("(shared information key)");- Getting messages: The "GetMessageDescription" method of the "GetMessage" class. (Figure 3.3-2)
// Get the message.
string message = GetMessage.GetMessageDescription("(message ID)");The screen transition control function is an optional function in which screen transitions are defined in an XML definition file and screens are transitioned using the defined screen transition labels. Enabling the screen transition check function makes undefined screen transitions errors.
Figure 4.1 Screen transition example
-
Screen tag: Specify the virtual path of the screen in the value attribute, and whether direct links (Get) are allowed (
allow) or denied (deny) in the directLink attribute. - Transition tag (child element of Screen): Specify the virtual path of the destination screen in the value attribute, the "screen transition label" (passed to the API) in the label attribute, and the screen transition method (T: Transfer, R: Redirect) in the mode attribute.
- CmnTransition tag (at the same level as Screen): Defines common transitions. Has value, label and mode attributes.
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE SCD[
<!ELEMENT SCD (Screen*, CmnTransition*)> <!ELEMENT Screen (Transition*)>
<!ELEMENT Transition EMPTY> <!ELEMENT CmnTransition EMPTY>
<!ATTLIST Screen value CDATA #REQUIRED directLink (allow|deny) "allow">
<!ATTLIST Transition value CDATA #REQUIRED label CDATA #REQUIRED mode (T|R) #IMPLIED>
<!ATTLIST CmnTransition value CDATA #REQUIRED label ID #REQUIRED mode (T|R) #IMPLIED>
]>
<!-- The virtual path of the current screen in the Screen tag could be an ID, but it contains "/", so it cannot be used as an XML ID. -->
<SCD>
<Screen value="/Aspx/start/login.aspx" directLink="allow"></Screen>
<Screen value="/Aspx/start/menu.aspx" directLink="allow"></Screen>
<Screen value="/Aspx/testScreenCtrl/WebForm0.aspx" directLink="allow">
<Transition value="/Aspx/testScreenCtrl/WebForm1.aspx" label="0→1" mode ="T"/>
<Transition value="/Aspx/testScreenCtrl/WebForm2.aspx" label="0→2" mode ="R"/>
<Transition value="/Aspx/testScreenCtrl/WebForm3.aspx" label="0→3" mode ="T"/>
<Transition value="/Aspx/testScreenCtrl/WebForm4.aspx" label="0→4" mode ="R"/>
<Transition value="/Aspx/testScreenCtrl/WebForm5.aspx" label="0→5" mode ="T"/>
</Screen>
<Screen value="/Aspx/testScreenCtrl/WebForm1.aspx" directLink="deny">
<Transition value="/Aspx/testScreenCtrl/WebForm2.aspx" label="1→2" mode ="R"/>
</Screen>
<Screen value="/Aspx/testScreenCtrl/WebForm2.aspx" directLink="deny">
<Transition value="/Aspx/testScreenCtrl/WebForm3.aspx" label="2→3" mode ="T"/>
</Screen>
<Screen value="/Aspx/testScreenCtrl/WebForm3.aspx" directLink="allow">
<Transition value="/Aspx/testScreenCtrl/WebForm4.aspx" label="3→4"/>
</Screen>
<Screen value="/Aspx/testScreenCtrl/WebForm4.aspx" directLink="deny">
<Transition value="/Aspx/testScreenCtrl/WebForm1.aspx" label="4→1"/>
<Transition value="/Aspx/testScreenCtrl/WebForm5.aspx" label="4→5"/>
</Screen>
<Screen value="/Aspx/testScreenCtrl/WebForm5.aspx" directLink="deny">
<Transition value="/Aspx/testScreenCtrl/WebForm1.aspx" label="5→1"/>
<Transition value="/Aspx/testScreenCtrl/WebForm2.aspx" label="5→2"/>
<Transition value="/Aspx/testScreenCtrl/WebForm3.aspx" label="5→3"/>
<Transition value="/Aspx/testScreenCtrl/WebForm4.aspx" label="5→4"/>
</Screen>
<CmnTransition value="/Aspx/testScreenCtrl/WebForm0.aspx" label="WebForm0"/>
<CmnTransition value="/Aspx/testScreenCtrl/WebForm3.aspx" label="WebForm3"/>
<CmnTransition
value="http:/www.google.co.jp/search?sourceid=navclient-ff&ie=UTF-8&rlz=1B3GGGL_jaJP268JP
268&aq=t" label="google" mode ="R"/>
</SCD>Figure 4.2 XML definition file of the screen transition control function
※ The value attribute can be defined including a Query String, but "&" must be escaped as & in XML.
<!-- Specify the screen transition method (T: Transfer, R: Redirect, off) -->
<add key="FxScreenTransitionMode" value="off"/>
<!-- On / off of the screen transition check function -->
<add key="FxScreenTransitionCheck" value="off"/>
<!-- Path to the screen transition definition -->
<add key="FxXMLSCDefinition" value="C:\root\files\resource\Xml\SCDefinition.xml"/>Figure 4.3 Config definition of the screen transition control function
-
FxScreenTransitionMode: Specifies whether the function is enabled or disabled and the default screen transition method (T or R). OFF disables the function. -
FxScreenTransitionCheck: Enables or disables the screen transition check function. ON makes undefined screen transitions errors. If the function is OFF, the check is also OFF. -
FxXMLSCDefinition: Path to the XML definition file. (Figure 4.3)
- When using the screen transition control function, use the "ScreenTransition" method of the "BaseController" class
// Label
string label = "(Label string)";
// Transition the screen using the screen transition control component
this.ScreenTransition(label);Figure 4.4-1 API of screen transition control
- The Label string to specify can include a Query String.
How to specify: "(Label string)?aaa=AAA&bbb=BBB&ccc=CCC"
- When transitioning screens without using the function, use the "FxTransfer" and "FxRedirect" methods
// Label
string url = "(URL string)";
// Screen transition under the framework's management (Transfer)
this.FxTransfer(url);
// Screen transition under the framework's management (Redirect)
this.FxRedirect(url);Figure 4.4-2 API of screen transition
- The URL string to specify can include a Query String.
How to specify: "(URL string)?aaa=AAA&bbb=BBB&ccc=CCC"
The transaction control function is an optional function in which transaction patterns are defined in an XML definition file and the data access control class (hereinafter DAM) is initialized with the defined pattern. When initializing multiple DAMs, multiple patterns can be grouped with a transaction group.
In the TransactionPattern tag, specify the pattern ID in the id attribute, the key to obtain the Connection String of the DB to connect to in the connkey attribute [11], and the isolation level in the isolevel attribute. In the TransactionGroup tag, specify the group ID in the id attribute and a comma-separated list of patterns in the value attribute (Figure 5.1).
Values of the isolevel attribute: nc (no connection), nt (no transaction), uc (read uncommitted), rc (read committed), rr (repeatable read), sz (serializable), ss (snapshot), df (default).
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE TCD[
<!ELEMENT TCD (TransactionPattern*, TransactionGroup*)>
<!ELEMENT TransactionPattern EMPTY>
<!ELEMENT TransactionGroup EMPTY>
<!ATTLIST TransactionPattern id ID #REQUIRED connkey CDATA #IMPLIED
isolevel (nc|nt|uc|rc|rr|sz|ss|df) "rc">]>
<!ATTLIST TransactionGroup id ID #REQUIRED value CDATA #REQUIRED>
<!-- id cannot start with a digit. -->
<TCD>
<!-- Define transaction patterns -->
<TransactionPattern id="SQL_NT" connkey="ConnectionString_SQLSvr" isolevel="nt"/>
<TransactionPattern id="SQL_UC" connkey="ConnectionString_SQLSvr" isolevel="uc"/>
<TransactionPattern id="SQL_RC" connkey="ConnectionString_SQLSvr" isolevel="rc"/>
<TransactionPattern id="SQL_RR" connkey="ConnectionString_SQLSvr" isolevel="rr"/>
<TransactionPattern id="SQL_SZ" connkey="ConnectionString_SQLSvr" isolevel="sz"/>
<TransactionPattern id="SQL_SS" connkey="ConnectionString_SQLSvr" isolevel="ss"/>
<TransactionPattern id="SQL_DF" connkey="ConnectionString_SQLSvr" isolevel="df"/>
<TransactionPattern id="NC" isolevel="nc"/>
<!-- Define transaction groups -->
<TransactionGroup id="SQLSvr" value="SQL_NT,SQL_UC,SQL_RC,SQL_RR,SQL_SZ,SQL_SS,SQL_DF"/>
</TCD>Specify the path to the file in the FxXMLTCDefinition parameter of app.config.
<!-- Path to the transaction control definition -->
<add key="XMLTCDefinition" value="C:\root\files\resource\Xml\TCDefinition.xml"/>Figure 5.2 Defining the path to the XML definition file of the transaction control function
To initialize a Dam with a defined pattern, use the "InitDam" method of the BaseLogic class.
// Work for Dam
BaseDam damWork;
// Create the Dam
damWork = new DamSqlSvr();
// Initialize the Dam
BaseLogic.InitDam("SQL_RC", damWork);
// Place the Dam under the framework's management with the "SetDam" method of the BaseLogic class.
this.SetDam(damWork);Figure 5.3-1 Initializing a Dam (sample code)
To initialize multiple Dams with a transaction group, get the patterns with "GetTransactionPatterns" and initialize them with "InitDam".
// Get the transaction patterns.
string[] transactionPatterns;
BaseLogic.GetTransactionPatterns("SQLSrv", out transactionPatterns);
// Work for Dam
BaseDam damWork;
// Initialize the Dams using the transaction patterns.
foreach (string transactionPattern in transactionPatterns)
{
// Create the Dam
damWork = new DamSqlSvr();
// Initialize the Dam
BaseLogic.InitDam(transactionPattern, damWork);
// Place under the framework's management
this.SetDam(transactionPattern, damWork);
}Figure 5.3-2 Initializing multiple Dams (sample code)
When making a service through communication control, etc., it is good to give the transaction pattern to the "business code class" as an attribute (attribute class), following the practice of attribute-based programming. Use the "MyAttribute" class of the [Touryo].Infrastructure.Business.Util namespace as the attribute class. To get the attribute class set on a class, use the MyAttribute.GetCustomAttributes(this) method.
/// <summary>Overview of LayerB</summary>
[MyAttribute(TransactionPatternID = "SQL_RC")]
public class LayerB : MyBaseLogic
{
public MyAttribute GetAttr()
{
return MyAttribute.GetCustomAttributes(this);
}Figure 5.4 Sample of attribute-based programming
The communication control function is an optional function in which the "call destination (protocol, address)" and the "call module (assembly, class)" corresponding to a "service logical name" are defined in XML definition files, and processing is called and executed with the defined "service logical name".
The major categories of call destinations in the communication control function are in-process and service interface. The supported protocols of the service interface are ASP.NET Web API and WCF (TCP/IP). The templates are ASPNETWebService.FxController and WCFService.WCFTCPSvcForFx located in ~\root\programs\C#\Frameworks\Infrastructure\ServiceInterface\ASPNETWebService, and the processing that converts context information and argument information into .NET objects and the server-side authentication processing must be implemented here.
Business processing can be implemented in the same way as the conventional B/D layers. The key point is to split projects so that the "type information" of arguments and return values, which is needed on both the client side and the server side, is built as a separate assembly. The "type information" must be referenceable from each of the client program, the service interface and the B/D layer program.
Figure 6.2.1 Creating a project dedicated to type information
When calling in-process from a client program, the framework and type information assemblies are referenced, and the B/D layer assemblies are deployed for late binding (the destination depends on the type of client).
Figure 6.2.2-1 In-process call on the client (Web application, Web service)
Figure 6.2.2-2 In-process call on the client (Windows / Console application)
Figure 6.2.2-3 In-process call via the service interface
The communication control function has two XML definition files.
-
Name resolution definition of the "call destination (protocol, address)": In the
Transmissiontag, specify the "service logical name" in the id attribute, and in-process (1) or ASP.NET Web Service (2) in the protocol attribute. For anything other than in-process, define the url and timeout attributes. Define the URL and connection option information with theUrlandProptags. (Figure 6.3.1; see Table 6.3.1 for connection options)
Table 6.3.1 Option information at connection time (main items)
| No. | Property | Description |
|---|---|---|
| 1 | Authentication credentials (UserName / Password / Domain) | Credentials for WAS [13] authentication |
| 2 | Proxy information (ProxyUrl / PUserName / PPassword / PDomain) | Requests via a proxy and proxy authentication |
| 3 | Client certificate (CertFile / CertPassword) | Authenticode X.509 v.3 certificate (multiple cannot be specified) |
| 4 | Compression | Enables or disables HTTP compression (true/false) |
| 5 | UserAgent | Value of the user agent header |
| 6 | ConnGroupName | Name of the connection group to use |
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE TMD[
<!ELEMENT TMD (Prop*, Url*, Transmission*)>
<!ELEMENT Url EMPTY><!ELEMENT Prop EMPTY><!ELEMENT Transmission EMPTY>
<!ATTLIST Url id ID #REQUIRED value CDATA #REQUIRED>
<!ATTLIST Prop id ID #REQUIRED value CDATA #REQUIRED>
<!ATTLIST Transmission id ID #REQUIRED protocol (1 | 2) #REQUIRED
url CDATA #IMPLIED url_ref IDREF #IMPLIED timeout CDATA #IMPLIED prop_ref IDREF #IMPLIED>
]>
<!-- id cannot start with a digit. --><!-- protocol: 1=InProcess, 2=WebService -->
<TMD>
<!-- Master data -->
<!-- Connection options (properties: as necessary) -->
<Prop id="prop_a" value="aaa=AAA;bbb=BBB;ccc=CCC;"/>
<!-- Connection options (URL: as necessary) -->
<Prop id="url_a" value="http://xxx/Service.asmx "/>
<!-- Connection destination data -->
<!-- In-process -->
<Transmission id="testInProcess" protocol="1"/>
<!-- Web service -->
<Transmission id="testWebSrv1" protocol="2" url="http://xxx/Service.asmx" timeout="60" />
<Transmission id="testWebSrv2" protocol="2" url_ref="url_a" timeout="60" prop_ref="prop_a" />
</TMD>Figure 6.3.1 XML definition file for the name resolution definition of the "call destination (protocol, address)"
-
Name resolution definition of the "call module (assembly, class)": In the
Transmissiontag, specify the "service logical name" in the id attribute, the assembly name in the assemblyName attribute and the class name (fully qualified name) in the className attribute. (Figure 6.3.2)
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE TMD[
<!ELEMENT TMD (Transmission*)> <!ELEMENT Transmission EMPTY>
<!ATTLIST Transmission id ID #REQUIRED assemblyName CDATA #REQUIRED className CDATA #REQUIRED>
]>
<!-- id cannot start with a digit. -->
<TMD>
<Transmission id="testInProcess" assemblyName="WSServer_sample"
className="WSServer_sample.Business.LayerB" />
<Transmission id="testWebService" assemblyName="WSServer_sample"
className="WSServer_sample.Business.LayerB" />
</TMD>Figure 6.3.2 XML definition file for the name resolution definition of the "call module (assembly, class)"
Placement: Place the "call destination" definition in the client program, and the "call module" definition in both the client (Web application) and the server (service interface), and specify the paths in the FxXMLTMProtocolDefinition (call destination) and FxXMLTMInProcessDefinition (call module) parameters of app.config. (Figure 6.4)
<!-- Paths to the name resolution definitions -->
<add key="FxXMLTMProtocolDefinition" value="C:\root\files\resource\Xml\TMProtocolDefinition.xml"/>
<add key="FxXMLTMInProcessDefinition" value="C:\root\files\resource\Xml\TMInProcessDefinition.xml"/>Figure 6.3.3 Defining the paths to the XML definition files of the communication control function
To call and execute processing with a defined "service logical name", use the "Invoke" method of the "CallController" class (Figure 6.5-1). Even when the communication control function is used, there is almost no difference from the method call processing of the "business code class" in section 4.2 of the Developers edition. The Context, ProxyUrl, NetworkCredentialToProxy and NetworkCredentialToWAS properties (write-only) can be specified on "CallController", and these values take precedence at execution time (Figure 6.5-2).
// Create the parameter class
TestParameterValue testParameterValue = new TestParameterValue(
"(any methodName value)", this.ContentPageFileNoEx, fxEventArgs.ButtonID,
"(any actionType value)", this.UserInfo.UserName, Request.UserHostAddress);
// Return value
TestReturnValue testReturnValue;
// Call control component
CallController cctrl = new CallController(this.UserInfo);
// Invoke
testReturnValue = (TestReturnValue)cctrl.Invoke(
this.ddlCmctCtrl.SelectedValue, testParameterValue);
// Message area to display the result
Label label = (Label)this.GetMasterWebControl("Label1");
label.Text = "";
if (testReturnValue.ErrorFlag == true)
{
// Result (business-continuable error)
label.Text = "ErrorMessageID:" + testReturnValue.ErrorMessageID + "\n";
label.Text += "ErrorMessage:" + testReturnValue.ErrorMessage + "\n";
label.Text += "ErrorInfo:" + testReturnValue.ErrorInfo + "\n";
}
else
{
// Result (normal case)
label.Text = testReturnValue.Obj.ToString();
}Figure 6.5-1 Calling and executing processing with a "service logical name".
// Call control component
CallController cctrl = new CallController(this.UserInfo);
// Context information, which is also specified in the constructor
cctrl.Context = this.UserInfo;
// Proxy URL when accessing via a proxy
cctrl.ProxyUrl = "(URL to the proxy)";
// Credentials for proxy authentication
cctrl.NetworkCredentialToProxy = new NetworkCredential("userID", "password", "domain");
// Credentials for WAS authentication
cctrl.NetworkCredentialToWAS = new NetworkCredential("userID", "password", "domain");Figure 6.5-2 Setting call option information
The Ajax cooperation function cooperates with Ajax functions such as Client Callback and ASP.NET 2.0 AJAX Extensions (both work as aspx postbacks).
The Client Callback function can be used by referring to the sample code (Figures 7.1-1 to 7.1-3).
/// <summary>Test screen of ClientCallback (P layer)</summary>
public partial class testClientCallback : MyBaseController,
System.Web.UI.ICallbackEventHandler // Note: Required to implement System.Web.UI.ICallbackEventHandler.
{
/// <summary>UOC method for page load (individual: first load)</summary>
/// <remarks>Must be implemented</remarks>
protected override void UOC_FormInit()
{
// Enable the client callback
// It must be executed each time in both Init and PostBack.
string CallServerScript = this.InitClientCallback();
// Hook WebForm_DoCallback to the event (lost focus).
// Edit the script
CallServerScript = CallServerScript.Replace("$SvrParam$", "this.value");
CallServerScript = CallServerScript.Replace( "$ClientCallbackReceiveEventHandler$", "CCREH_MethodName");
CallServerScript = CallServerScript.Replace("$CliParam$", "this.name");
// Set the script
((TextBox)this.GetMasterWebControl("TextBox1")).Attributes.Add("onblur", CallServerScript);
((TextBox)this.GetContentWebControl("TextBox1")).Attributes.Add("onblur", CallServerScript);
}
/// <summary>UOC method for page load (individual: postback)</summary>
/// <remarks>Must be implemented</remarks>
protected override void UOC_FormInit_PostBack()
{
// Implement the processing to run at form initialization (postback)
// TODO:
// Enable the client callback
// It must be executed each time in both Init and PostBack.
string CallServerScript = this.InitClientCallback();
}
/// <summary>Enables the client callback.</summary>
private string InitClientCallback()
{
//// 1st argument: Screen instance on the server
//// 2nd argument: Argument to the WebForm_DoCallback (server call) function. getElementById (javascript) + Control.ClientID, etc. may also be used together.
//// 3rd argument: Callback function
//// 4th argument: Argument to the callback function. getElementById (javascript) + Control.ClientID, etc. may also be used together.
// Make the 2nd, 3rd and 4th arguments variable.
return this.ClientScript.GetCallbackEventReference(this, "$SvrParam$", "$ClientCallbackReceiveEventHandler$", "$CliParam$");Figure 7.1-1 Preparing to use Client Callback
// Variable that stores the processing result
private string CallbackResult = "";
/// <summary>Event handler that executes the processing in ClientCallback</summary>
/// <param name="eventArgument"></param>
void ICallbackEventHandler.RaiseCallbackEvent(string eventArgument)
{
// ~ Processing ~
// Set the processing result.
this.CallbackResult = sbr.ToString(); ;
}
/// <summary>Event handler that returns the value in ClientCallback</summary>
/// <returns>Processing result</returns>
string ICallbackEventHandler.GetCallbackResult()
{
// Return the processing result value.
return this.CallbackResult;
}
}Figure 7.1-2 Implementing the server processing
<input type="text"
id="ctl00_ContentPlaceHolder1_TextBox1" name="ctl00$ContentPlaceHolder1$TextBox1"
onblur="WebForm_DoCallback('__Page', this.value, CCREH_MethodName, this.name)"
style="color:Black;font-family:MS ゴシック;font-size:12pt;" />
<script type="text/javascript">
function CCREH_MethodName(arg, context)
{
// arg is the processing result on the server side,
// context is the argument to the callback function specified as the fourth argument
}
</script>Figure 7.1-3 Implementing the client processing
The key point is that only one entry point can be prepared for the server-side processing function (multiple client-side result receiving functions can be prepared per processing category). In the "PageLoad" event, etc., the this.IsClientCallback property can be used to determine whether the request is a normal postback or from Client Callback.
With Extensions, event handlers can be implemented in the same way as the event processing function of the P layer framework. To use it, place a script manager on the master page (Figure 7.2-1), and place a script manager proxy on the content page if necessary (Figure 7.2-2).
<form id="form1" runat="server">
<asp:ScriptManager ID="MasterScriptManager" runat="server"
AsyncPostBackErrorMessage="Server-side error (defined in MasterScriptManager)" AsyncPostBackTimeout="10">
</asp:ScriptManager>Figure 7.2-1 Script manager
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:ScriptManagerProxy ID="ContentsScriptManagerProxy" runat="server"></asp:ScriptManagerProxy>Figure 7.2-2 Script manager proxy
Enclose the controls targeted by Extensions in an update panel (Figures 7.2-3 to 7.2-5).
<asp:UpdatePanel ID="MasterUpdatePanel" runat="server">
<ContentTemplate>
<cc1:WebCustomButton ID="btnMButton1" runat="server" Text="Ajax button" Width="180px" /><br />
<asp:contentplaceholder id="ContentPlaceHolder1" runat="Server"></asp:contentplaceholder>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnMButton1" EventName="Click" />
</Triggers>
</asp:UpdatePanel>Figure 7.2-3 Enclosing in an update panel
<asp:UpdatePanel ID="MasterUpdatePanel" runat="server">
<ContentTemplate>
<cc1:WebCustomButton ID="btnMButton1" runat="server" Text="Ajax button" Width="180px" /><br />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnMButton1" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
<asp:contentplaceholder id="ContentPlaceHolder1" runat="Server"></asp:contentplaceholder>Figure 7.2-4 Enclosing in an update panel (master page side)
<asp:UpdatePanel ID="ContentUpdatePanel" runat="server">
<ContentTemplate>
<cc1:WebCustomButton ID="btnButton1" runat="server" Text="Ajax button" Width="180px" /><br />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnButton1" EventName="Click" />
</Triggers>
</asp:UpdatePanel>Figure 7.2-5 Enclosing in an update panel (content page side)
In the code-behind, the script manager (this.CurrentScriptManager) can be used to change a control between a postback target and an Extensions target (Figure 7.2-6).
// Use the RegisterPostBackControl method to make "btnButton1" and "ddlDropDownList1" non-Ajax.
// ※ The reverse operation is RegisterAsyncPostBackControl.
this.CurrentScriptManager.RegisterPostBackControl(this.GetContentWebControl("btnButton1"));
this.CurrentScriptManager.RegisterPostBackControl(this.GetContentWebControl("ddlDropDownList1"));Figure 7.2-6 Changing between postback target and Extensions target
Whether the current request is a normal postback or one from Extensions can be determined with this.CurrentScriptManager.IsInAsyncPostBack or the this.AjaxExtensionStatus property. AjaxExtensionStatus (FxEnum.AjaxExtStat) can distinguish three states: IsNotAjaxExtension (normal postback), IsAjaxExtension (Extensions postback) and NoAjaxExtension (screens that do not support Extensions).
-
Modern browser support (dialog display function [16]): The window.showModalDialog used by the OK modal dialog and Yes/No modal dialog of the "dialog display function" was replaced with a floating div to support modern browsers. Business modal dialogs were changed from
window.showModalDialogto thewindow.openmethod, and support for theBaseController.CloseModalScreen_WithAllParent()method has ended. - Screen transition related: Cross-page posting [17] is not supported. When Transfer is used, Form information, etc. is not carried over (the recommended ways to pass information are Transfer: HTTP context, Redirect: HTTP session). When transitioning screens without using the methods provided by the framework, the "session area per window" cannot be used.
- Processing related to encoding.
- HTML encoding.
- URL encoding.
- Child screen display function (message dialogs, business modal / modeless screens).
- Session management function.
- For .NET WSB (Web service bridge).
- URL of the business modal dialog to display.
- The default value of directLink can be changed to deny by changing the DTD.
- If the screen transition check function is turned OFF, the check processing is not executed.
- Methods of the screen transition control function.
- Key of the connectionStrings section.
- Specify the option information at connection time as a string.
- WAS (Web Application Server).
- Changes the control to a postback target.
- Returns the control to an Extensions target.
- Cross-Page Posting.
-End-
Copyright © 2007,2017, Hitachi Solutions, Ltd.