Create an Assembly
Assemblies work similarly to Visual Studio Code. There is a project with folders that each contain dependencies, such as assemblies and business rules. Assemblies enable developers to add references to known packages that are part of the standard server install, such as OpenXML. In the OneStream application, assemblies are located within maintenance units.
TIP: If you need to reference an assembly from a business rule, use the following syntax: WS\ followed by the long Workspace assembly name. For example: WS\Workspace.wsName.wsAssemblyName
Create a Workspace Assembly Using Visual Basic
NOTE: Assemblies can be C# or Visual Basic.
-
Go to the Workspace and maintenance unit to create the assembly.
-
Select the Assemblies node to expand it.
NOTE: You will not see this option in the default maintenance unit, which is located in the Default Workspace. This maintenance unit only stores Cube View groups.
-
On the toolbar, select the Create Assembly icon.
-
On the Assembly Properties tab, for the Compiler Language field, in the drop-down menu, select the type of assembly: C# or Visual Basic.
-
Name the assembly.
-
Select the Save icon.
Create an Assembly File
The assembly file is where you write the logic. You can choose to write a business rule type or a rule of your own. Writing a custom rule provides greater flexibility and is the preferred option for most developers. It can also improve performance.
-
Select an assembly, then select the Assembly Files tab.
-
Right-click on Files, and select Add File.
-
In the Add File dialog box, complete these fields:
-
In the File Name field, enter a name for the file.
-
In the Source Code Type drop-down menu, select Business Rule or Service Type.
-
In the Compiler Action drop-down menu, select an option.
-
(Use Default) or Compile: These options will compile the file when the assembly is compiled.
-
Disabled: This option will not compile the assembly to verify syntax.
-
-
-
Select the OK button.
-
In the toolbar, select the Save icon. The Workspace will look similar to the following image.
NOTE: On the Assembly Files tab, you can change the Compiler Action option, but you cannot change the Business Rule Type. To change the Business Rule Type, you must delete the file and recreate it.
Delete an Assembly File
-
Select the assembly file to delete.
-
On the Assembly Properties tab, select the Delete icon.
Encrypt an Assembly File
Encryption protects assembly files from users who may have access to a Workspace. Security can be controlled in the following ways:
-
Workspace level (access and maintenance security)
-
Maintenance unit level (access and maintenance security)
-
Application security roles that prevent others from writing assemblies in the Application Workspaces page (AdministerApplicationWorkspaceAssemblies)
-
System security roles that prevent others from writing assemblies in the System Workspaces page (SystemApplicationWorkspaceAssemblies)
You must be a member of the EncryptBusinessRules security role group to encrypt assembly files. Within Workspace assemblies, you can create rules using C# or Visual Basic.
-
Right-click on the assembly file name.
-
Select Encrypt File.
-
In the Encrypt File dialog box, enter a password for encryption using the legacy rules.
-
Select the OK button.
You can also decrypt files by right-clicking on the encrypted file, selecting Decrypt File, and then entering the previously created password.
Create an Assembly Folder
Create assembly folders to organize your assembly files.
-
Select the assembly, then select the Assembly Files tab.
-
Right-click on Files, and select Add Folder.
-
Name the folder, then select the OK button.
-
(Optional) To add files to the folder, right-click on the folder and select Add File.
NOTE: You cannot drag and drop files into a folder.
Create a Dependency
Dependencies are useful when you have methods within other assemblies or business rules.
-
Select the assembly, then select the Assembly Files tab.
-
Right-click on Dependencies, and select Add Dependency.
-
In the Dependency Type drop-down menu, select an option:
-
Workspace Assembly: Select this option if other assemblies might be included in the Workspace. If you create a dependency with another Workspace, you must provide the Shared Workspace Name, and this Workspace must have the Is Shareable Workspace property set to True.
The following example shows the dependency setup. Multiple Workspaces can be entered in a comma-separated list.
NOTE: To create a dependency within the same Workspace, leave the Shared Workspace Name field blank.
-
Prepackaged Assembly: Select this option to use the assembly that is automatically included with OneStream.
-
Business Rule: Select this option to create dependencies with any business rules located on the Business Rules page. In the Dependency Name field, enter the name of the business rule.
-
-
In the toolbar, select the Save icon.
After creating dependencies, you might receive an error when compiling the assembly if something is incorrect within the assembly or dependency itself.
These are important notes to be aware of when compiling with assemblies:
-
If the Compiler Action is set to Disabled for any dependent assembly file, you will not see an error even if there are issues wtih the syntax. For example, the following dependent assembly would not produce a syntax error even though one is present.
-
Properties on the Assembly Files tab require you to enter the exact name of the Workspace, assembly, and business rule. If they are incorrect, you will receive a compile error.