Xeku.Scripts 0.0.0.7

dotnet add package Xeku.Scripts --version 0.0.0.7
                    
NuGet\Install-Package Xeku.Scripts -Version 0.0.0.7
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Xeku.Scripts" Version="0.0.0.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Xeku.Scripts" Version="0.0.0.7" />
                    
Directory.Packages.props
<PackageReference Include="Xeku.Scripts" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Xeku.Scripts --version 0.0.0.7
                    
#r "nuget: Xeku.Scripts, 0.0.0.7"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Xeku.Scripts@0.0.0.7
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Xeku.Scripts&version=0.0.0.7
                    
Install as a Cake Addin
#tool nuget:?package=Xeku.Scripts&version=0.0.0.7
                    
Install as a Cake Tool

Xeku.Scripts

An XAF module for dynamic C# script compilation and execution using Roslyn.

Features

  • Script Types: Support for Action, Function, Validator, and Transformer patterns.
  • Dynamic Compilation: Compile C# code at runtime using Roslyn.
  • IScriptService: Programmatic API for executing scripts from other modules or code.
  • Asynchronous Support: Full support for async/await in script logic.
  • Monaco Editor Integration: Professional code editor with syntax highlighting.
  • ScriptContext API: Simplified interface for scripts to interact with XAF.
  • Execution Logging: Track script execution history with JSON serialization for complex return values.
  • Assembly Caching: Optimized performance through compiled assembly caching.

Installation

dotnet add package Xeku.Scripts

Dependencies

  • Xeku.Core - Core module with common services
  • Xeku.Editors - Monaco editor support

Usage

Script Types

Type Signature Description
Action void Run(ScriptContext ctx) Performs operations without returning a value.
Function object Run(ScriptContext ctx) Computes and returns a value. Supports async Task<object>.
Validator bool Validate(ScriptContext ctx, object target) Returns true if validation passes for a target object.
Transformer object Transform(ScriptContext ctx, object input) Converts an input object into an output object.

Basic Script Structure

public class ScriptMain
{
    // Example Action Script
    public void Run(ScriptContext ctx)
    {
        ctx.ShowMessage("Hello from Script!");
    }
}

IScriptService

Register the service in your startup:

services.AddScripts();

Usage in your code:

public class MyService {
    private readonly IScriptService _scriptService;
    
    public async Task Process() {
        var result = await _scriptService.ExecuteAsync("MyScript");
        if (result.IsSuccess) {
            // Handle success
        }
    }
}

ScriptContext API

Method Description
CreateObject<T>() Create a new business object
Query<T>() Query objects using LINQ
GetObjectByKey<T>(key) Retrieve an object by its primary key
CommitChanges() Save pending changes
ShowMessage(msg) Queue an info message
ShowWarning(msg) Queue a warning message
ShowError(msg) Queue an error message
Log(msg) Write to trace output

Integration

  1. Add module reference in your Module.cs:
RequiredModuleTypes.Add(typeof(Xeku.Scripts.ScriptsModule));
  1. Register services in Startup.cs:
public void ConfigureServices(IServiceCollection services) {
    // ...
    services.AddScripts();
}

AI Code Generation 🤖

This module supports automatic script code generation using Large Language Models (LLMs).

Supported LLM Providers

Provider Environment Variable Description
OpenAI OPENAI_API_KEY GPT-4, GPT-3.5, etc.
Google Gemini GEMINI_API_KEY Gemini 1.5 Pro, Flash
Azure OpenAI AZURE_OPENAI_API_KEY, AZURE_OPENAI_ENDPOINT Enterprise deployment
Ollama OLLAMA_BASE_URL Local models (free)

Configuration

# Set LLM provider (openai, gemini, azureopenai, ollama)
setx LLM_PROVIDER "gemini"

# Set API key based on provider
setx GEMINI_API_KEY "your-api-key"

Business Object Auto-Discovery

The AI generation feature automatically scans all Business Objects in your project, allowing AI to understand available classes and properties. Users simply describe their requirements in natural language, for example:

Query all orders created today, calculate total amount and display

AI will automatically generate correct code based on your project's Order class and its properties.

Business Objects

Class Description
Script Stores script metadata, code, and compiled assembly
ScriptExecutionLog Records execution history (read-only in UI)

Actions

Action Description
Compile Compile the script code
Run Execute the script
Run with Context Execute with ScriptContext parameter
Clear Logs Delete all execution logs for the script
Generate with AI Auto-generate script code using AI

Architecture

graph TD
    subgraph Runtime
        Script[Script Business Object]
        Roslyn[Roslyn Compiler]
        Cache[Assembly Cache]
    end
    
    subgraph Execution
        Controller[ScriptController]
        Context[ScriptContext]
        Log[ExecutionLog]
    end
    
    Script --> Roslyn
    Roslyn --> Cache
    Controller --> Script
    Controller --> Context
    Controller --> Log

License

Proprietary - Xeku Solutions

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Xeku.Scripts:

Package Downloads
Xeku.Triggers

XAF module providing trigger rules and webhook execution for CRUD operations.

Xeku.Scripts.Blazor

Xeku Scripts Blazor module for DevExpress XAF Blazor applications. Enables Monaco editor support for script editing.

Xeku.Scripts.WebApi

Xeku Scripts WebApi module for remote script execution via OData/REST API.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.0.7 193 1/28/2026
0.0.0.6 85 1/21/2026