#
Auto-generated Helpers
When writing custom endpoint code or other server-side logic in the Workspace, you often need to refer to Node Types, Field names, Edge Types, Endpoints, and AI Tools defined in your system.
Instead of hardcoding these strings, the CodeManager class automatically generates and injects strongly typed helper classes into your execution context.
These helpers allow you to access your definitions safely and efficiently.
#
Available Helpers
#
N (Nodes)
The N helper exposes your schema hierarchy as nested static classes and constants for Node Types and their fields.
N.MyType.Type: The Node Type name (e.g.,"MyType").N.MyType.MyField: The name of a field (e.g.,"MyField").
Example:
var salesEmployees = Q()
.StartAt(N.Employee.Type)
.Where(N.Employee.Department, "Sales")
.ToList();
#
E (Edges)
The E helper exposes your Edge Types as string constants.
E.MyEdge: The name of an edge type (e.g.,"MyEdge").
Example:
var edges = node.GetEdges(E.MyEdge);
#
Endpoints
The Endpoints helper exposes your Custom Endpoints as string constants containing their paths. This is useful when calling other endpoints.
Endpoints.MyGroup.MyEndpoint: The path of the endpoint (e.g.,"MyGroup/MyEndpoint").
Example:
// Calling another endpoint
await CallEndpointAsync(Endpoints.Sales_CalculateBonus, ...);
#
AI_Tools
The AI_Tools helper exposes your AI Tools as string constants containing their UIDs. This is useful when invoking AI tools programmatically.
AI_Tools.MyTool: The UID of the AI Tool.
Example:
// Using a tool in a chat session
await chat.UseToolAsync(AI_Tools.ImageGenerator, ...);
#
Compilation Time vs. Execution Time
Using these helpers offers significant advantages over using raw strings:
- Compile-Time Safety: Typos are caught immediately.
- Refactoring Support: Renaming a field or endpoint updates the helper (or breaks the code, prompting a fix).
- Autocomplete: IntelliSense support in the code editor.
info "Related Scopes"
For more information on the objects and methods available in your code execution environment, see [**Global Scope**](global-scope.md).