Workspace Assemblies

Referencing Dependency Classes in Code

Once you've set up assembly dependencies, you can reference the dependency's classes directly in your VB.NET or C# code using the compiled namespace.

Compiled Namespace Pattern

Every workspace assembly file compiles into a namespace following this pattern:
plaintext
1Workspace.{NamespacePrefix}.{AssemblyName}
Where:
  • NamespacePrefix — the workspace's Namespace Prefix property (found in workspace properties). If blank, defaults to the workspace name (sanitized). For the Default workspace, this is always Default.
  • AssemblyName — the name of the assembly (sanitized — no spaces)
Each file in the assembly becomes a class within that namespace.

Fully Qualified Reference

1' Fully qualified call — no Imports needed
2Dim formatted As String = Workspace.FP.SharedLib.Utilities.FormatAmount(1234.5D)

Using Imports / using Directives

Add an Imports (VB.NET) or using (C#) line at the top of the file to shorten references:
1Imports Workspace.FP.SharedLib
2
3Namespace Workspace.__WsNamespacePrefix.__WsAssemblyName
4  Public Class MyReport
5
6      Public Function GetDisplay(amount As Decimal) As String
7          ' Now you can reference the class directly
8          Return Utilities.FormatAmount(amount)
9      End Function
10
11  End Class
12End Namespace

MainClass Example (Dashboard DataSet)

This is the most common pattern — a MainClass entry point calling into a shared dependency. The DataSet returns a DataTable built from a SQL query and uses a shared utility to format a column value:
1Imports Workspace.FP.SharedLib
2
3Namespace Workspace.__WsNamespacePrefix.__WsAssemblyName
4  Public Class MainClass
5      Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As DashboardDataSetArgs) As Object
6          Try
7              Select Case args.FunctionType
8                  Case Is = DashboardDataSetFunctionType.GetDataSet
9                      If args.DataSetName.XFEqualsIgnoreCase("SummaryReport") Then
10                          Dim sql As String = "SELECT EntityName, ScenarioName, Amount FROM vFactData WHERE ScenarioName = @Scenario"
11                          Dim dbParams As New List(Of DbParamInfo)
12                          dbParams.Add(New DbParamInfo("@Scenario", args.NameValuePairs.XFGetValue("Scenario", "Actual")))
13
14                          Using dbConn As DbConnInfo = BRApi.Database.CreateApplicationDbConnInfo(si)
15                              Dim dt As DataTable = BRApi.Database.ExecuteSqlUsingReader(dbConn, sql, dbParams, False)
16
17                              ' Use a shared utility from the dependency assembly to format each row
18                              For Each row As DataRow In dt.Rows
19                                  row("Amount") = Utilities.FormatAmount(CDec(row("Amount")))
20                              Next
21
22                              Return dt
23                          End Using
24                      End If
25              End Select
26
27              Return Nothing
28          Catch ex As Exception
29              Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
30          End Try
31      End Function
32  End Class
33End Namespace

Referencing Methods on a MainClass From Another Assembly

You can reference a MainClass from another assembly the same way you'd reference any other class — it compiles to Workspace.{Prefix}.{Assembly}.MainClass. However, there are important constraints:
  • Methods must be Public Shared (VB.NET) / public static (C#) to call them without instantiating MainClass. The Main entry point itself is an instance method invoked by the OneStream runtime, so it is not directly callable.
  • Avoid calling Main directly — it expects runtime-provided args objects (e.g., DashboardDataSetArgs) that are not meant to be constructed manually.

Calling a Shared Helper on MainClass

diagramCross-Assembly MainClass Reference

Loading diagram...

Suppose assembly DataSetLib has a file ds_Revenue with a MainClass that includes a reusable helper:
1' In DataSetLib > ds_Revenue — the source assembly
2Namespace Workspace.__WsNamespacePrefix.__WsAssemblyName
3  Public Class MainClass
4      Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As DashboardDataSetArgs) As Object
5          Try
6              ' ... entry point logic ...
7              Return Nothing
8          Catch ex As Exception
9              Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
10          End Try
11      End Function
12
13      ''' <summary>Reusable helper — must be Public Shared for cross-assembly access.</summary>
14      Public Shared Function BuildRevenueFilter(si As SessionInfo, scenarioName As String) As String
15          Return $"E#Root.Base:S#{scenarioName}:T#{BRApi.Finance.Time.GetNameFromId(si, si.WorkflowClusterPk.TimeKey)}"
16      End Function
17  End Class
18End Namespace
From another assembly (with a dependency on DataSetLib), reference the helper via the MainClass path:
1Imports Workspace.FP.DataSetLib
2
3Namespace Workspace.__WsNamespacePrefix.__WsAssemblyName
4  Public Class MainClass
5      Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As DashboardExtenderArgs) As Object
6          Try
7              ' Reference the MainClass from the other assembly by name
8              Dim filter As String = ds_Revenue.BuildRevenueFilter(si, "Actual")
9
10              ' Or fully qualified
11              Dim filter2 As String = Workspace.FP.DataSetLib.ds_Revenue.BuildRevenueFilter(si, "Actual")
12
13              Return Nothing
14          Catch ex As Exception
15              Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
16          End Try
17      End Function
18  End Class
19End Namespace
ℹ️Info
The class name used in the reference is the file name (ds_Revenue), not MainClass. OneStream compiles each file into a class named after the file. The Public Class MainClass you write inside the file is nested within that generated structure. To reference it externally, use the file name as the class identifier.
If the method you need is a Public instance method (not Shared), you can instantiate MainClass and call it:
vbnet
1Imports Workspace.FP.DataSetLib
2
3' Create a new instance of the other assembly's MainClass
4Dim revenueRule As New ds_Revenue.MainClass()
5
6' Call an instance method on it
7Dim filter As String = revenueRule.BuildRevenueFilter(si, "Actual")
Why this is not optimal:
  1. Unnecessary object allocation. MainClass is designed to be instantiated once by the OneStream runtime. Creating a second instance allocates memory for an object whose only purpose is to serve as a method container.
  2. Misleading intent. When another developer sees New ds_Revenue.MainClass(), it looks like you're trying to re-execute that business rule, obscuring the fact that you just need a helper function.
  3. Risk of side effects. If MainClass has a constructor or field initializers that assume runtime invocation, instantiating it yourself may produce unexpected behavior.
  4. Fragile coupling. Your code depends on MainClass remaining instantiable with a parameterless constructor.
Prefer Public Shared instead. Mark reusable methods as Public Shared (VB.NET) / public static (C#) so callers never need to instantiate MainClass:
vbnet
1' In the source file — mark the helper as Shared
2Public Shared Function BuildRevenueFilter(si As SessionInfo, scenarioName As String) As String
3  Return $"E#Root.Base:S#{scenarioName}:T#{BRApi.Finance.Time.GetNameFromId(si, si.WorkflowClusterPk.TimeKey)}"
4End Function
5
6' In the consuming file — no instantiation needed
7Dim filter As String = ds_Revenue.BuildRevenueFilter(si, "Actual")

Extract Shared Logic

If you find yourself needing to call MainClass methods from other assemblies frequently, consider moving the shared logic into its own file/class. This keeps MainClass focused on its entry-point role and makes dependencies clearer:
diagramExtracting Shared Logic

Loading diagram...

Both DataSetLib and Reports depend on SharedLib for reusable logic. Neither needs to reference the other's MainClass.

Cross-Workspace References

diagramCross-Workspace Reference

Loading diagram...

If the source assembly is in a different workspace (e.g., workspace SharedWorkspace with Namespace Prefix = Shared), the namespace changes accordingly:
vbnet
1' Cross-workspace reference
2Dim result As String = Workspace.Shared.SharedLib.Utilities.FormatAmount(1234.5D)
3
4' Or with Imports:
5Imports Workspace.Shared.SharedLib
ℹ️Info
About __WsNamespacePrefix and __WsAssemblyName: These are placeholder variables in your own assembly's Namespace declaration. OneStream replaces them at compile time with the actual workspace prefix and assembly name. When referencing a dependency assembly's classes, always use the actual resolved namespace prefix and assembly name — not the placeholder variables.

Finding a Workspace's Namespace Prefix

To check or set the namespace prefix:
  1. Go to Application > Presentation > Workspaces
  2. Select the workspace
  3. Look at (or set) the Namespace Prefix property
  4. If the field is blank, the workspace name is used as the prefix