Bragi Docs Help

Transform Data Using C# With Code Configs

Code Configs let you write custom C# Code to handle edge cases, external API calls, or complex business logic.

Code components behave like any other step in your pipeline, and they are integrated with the rest of Bragi’s automation features.

Bragi ensures:

  • Environment variables are automatically passed in

  • Each version of your code is tracked and auditable

  • Dependencies are resolved automatically so you can build once and promote safely

Step 1: Name Your Code Config

When setting up a new Code component, you’ll be asked for:

Field

Description

Display Name

A human-friendly name for the Code, used throughout Bragi’s UI.

Description

Explain what the Code does and why. Especially useful when someone else picks it up later.

Manual Lifecycle Handling

By default, Bragi truncates and reloads the output table each time. Turn this on if you want full control (e.g. to append, not truncate). You still need to return the data, but Bragi won’t touch the table lifecycle.

The New Code Config screen

Step 2: Write Your Transformation C#

Bragi gives you an empty template when creating a new Code:

using System; using System.Linq; using System.Data; using System.Threading.Tasks; using System.Text.Json; using System.Net.Http; using Bragi.CodeExternal; using Bragi.Util; public class MyCodeConfigImpl : ICodeConfigCode { public async Task<BragiCodeResult> CodeImpl(IBragiCodeUtil bragiCodeUtil) { try { // Todo: Code here var env = await bragiCodeUtil.GetEnvironmentDetails(); bragiCodeUtil.LogInformation("Running code in " + env.Name); return new BragiCodeResult(BragiCodeResultCode.Success); }+++ catch (Exception ex) { return new BragiCodeResult(BragiCodeResultCode.Fatal, ex.Message); } } }

Use BragiCodeExtension classes for consistency across code configs and use BragiCodeUtil classes to speed up development.

09 March 2026