Overview
Script Classes in FrameworkX are custom code structures that allow for the creation and organization of reusable scripts. Written in C#, VB.NET, or Python, these classes enable users to develop functionalities that can be used multiple times throughout the soluiton.
On this page:
Table of Contents | ||
---|---|---|
|
Configuring Classes
ScriptClasses allow you to create a repository of class libraries, methods, and functions that you can use across the application. You can call them from tasks, other classes, and
the display's code behind
functionality.
Configuring ScriptClasses
To create and configure a new ScriptClass follow the steps below:
Access Scripts → Classes
Click on the plus icon.
Input a class name and description, select the desired language and choose the domain of the class.
Choose to either create a new code or import one from an existing library.
Choose the content type for the class.
Click Ok.
Now, you can double-click the newly created row to access the Code Editor, where you can insert the code for the ScriptClass.
Info |
---|
To edit a property of an existing object, click the desired property to select it and click it again after a second to edit it. See a list of available properties in the next section. |
The image below illustrates the process described above.
Built-in ScriptClasses
All solutions include the following built-in ScriptClasses:
- ServerMain: The methods library available for all server tasks.
- ClientMain: The methods library available for all clients.
ScriptClasses Configuration Tables
The following is a table describing each available property field for ScriptClasses:
Property | Description |
Name | The name of the class. |
Code | Specifies the language used for the code of this Class |
FactoryStudio comes with the following built-in classes:
- ServerMain—Methods library available for all server tasks.
- ClientMain—Methods library available for all clients.
To configure classes:
- Go to Scripts > Classes.
- Select a class name, or select the insert row (first row) to create a new class.
- Enter or select information, as needed.
- Then you can double-click on the row created to go to Code Editor.
Column
Description
Name
Enter a name for the class. The system lets you know if the name is not valid.
Code
. By default, this is the language you selected when you created the |
solution. |
Domain |
The location where the class executes, there are two options: |
|
|
|
Content
| |
ClassContent | The |
type of the content in the class ( |
Methods or Namespace) |
Edit Security |
The security to enable who can edit the tasks. |
Build Order |
The order to build the classes. |
BuildStatus
Build Status | The |
Status of the class code from the continuous compiling process.
|
|
|
|
|
|
|
BuildErrors
Build Errors |
Displays any errors encountered during the last build. |
Description |
The description of this class. |
- Apply all namespaces that will be used in your code, e.g.
- “Using System”
- “System.IO.StremReader”
- Click Save.
- Apply all namespaces that will be used in your code, e.g.
Circular References
A circular reference occurs when two classes mutually depend on each other. For example:
- Class A has methods or attributes that reference Class B.
- Class B, in turn, has methods or attributes that reference Class A.
This structure creates a “circularity” between the classes, leading to compilation failures and complicating code maintenance.
How Compilation Caching Works with Circular References:
When Saving a Class Individually: When a class (e.g., Class A) is saved, the system caches the last successfully compiled version. Therefore, if Class B references Class A, and Class A is then altered in a way that causes a compilation error, this error may not immediately appear in Class B because the cache retains the last valid version.
During a Complete Solution Build: During a full build, the cache is cleared, and all classes are recompiled from scratch. In this process:
- If there are circular references and one of the classes contains a compilation error, none of the classes will compile successfully. To resolve this, one of the circular references should be temporarily removed (commented out or deleted), allowing the successful compilation of one of the classes by saving. Then, the removed reference can be reinserted in the other class, now correctly compiled.
Note |
---|
We emphasize that using circular references is not a recommended practice. This kind of mutual dependency compromises code stability and maintainability, complicates debugging, and leads to complete build failures. |
Recommendations:
- Guide users to avoid circular references between classes whenever possible, as this will simplify compilation and maintenance.
- Include an explanatory note that, while the system does not block the creation of circular references, this practice is not recommended, as it often leads to compilation difficulties and stability issues.
In this section:
In this section...Page Tree | ||||
---|---|---|---|---|
|