IBeam.Services 2.9.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package IBeam.Services --version 2.9.0
                    
NuGet\Install-Package IBeam.Services -Version 2.9.0
                    
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="IBeam.Services" Version="2.9.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="IBeam.Services" Version="2.9.0" />
                    
Directory.Packages.props
<PackageReference Include="IBeam.Services" />
                    
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 IBeam.Services --version 2.9.0
                    
#r "nuget: IBeam.Services, 2.9.0"
                    
#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 IBeam.Services@2.9.0
                    
#: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=IBeam.Services&version=2.9.0
                    
Install as a Cake Addin
#tool nuget:?package=IBeam.Services&version=2.9.0
                    
Install as a Cake Tool

IBeam.Services

IBeam.Services contains the core service-layer abstractions, base CRUD services, operation metadata, audit hooks, and policy execution primitives used across IBeam.

dotnet add package IBeam.Services

When To Use This

  • You are building an IBeam service around one entity.
  • You want base CRUD behavior with override points.
  • You need service-operation tags such as [IBeamOperation("patients.discharge")].
  • You want permissions, auditing, validation, and error behavior to stay in the service layer.
  • You are using your own authentication system but still want IBeam service policy and audit patterns.

What This Package Contains

Area Type(s) Purpose
Base services BaseService<TEntity,TModel>, BaseServiceAsync<TEntity,TModel> Reusable CRUD framework over repositories and model mappers.
Service contracts IBaseService<TEntity,TModel>, IBaseServiceAsync<TEntity,TModel> Common service operations for apps and APIs.
Mapping IModelMapper<TEntity,TModel> Keeps entity/model conversion behind a small abstraction.
Operation metadata IBeamOperationAttribute, IBeamAuditActionAttribute, IBeamRequiresPermissionAttribute Names service calls for authorization, auditing, and debugging.
Operation execution IServiceOperationExecutor, ServiceOperationExecutionOptions Wraps custom methods with the same policy/audit behavior as base CRUD methods.
Policy resolution IServiceOperationPolicyResolver, ServicePolicyOptions Enables or disables CRUD operations per service.
Audit hooks IAuditTrailSink, IAuditActorProvider, IAuditRequestContextProvider Captures who changed what, where, and when.

Architecture Fit

API <-- DTO/model object --> Service <-- Entity --> Repository

The service layer is the gatekeeper in IBeam. Controllers should bind requests and return responses. Repositories should persist one entity. Services should own business rules, permission checks, logging/auditing decisions, validation, error classification, and cross-service coordination.

Base CRUD Pattern

[IBeamOperation("products")]
public sealed class ProductsService : BaseServiceAsync<ProductEntity, ProductDto>
{
    public ProductsService(
        IBaseRepositoryAsync<ProductEntity> repository,
        IModelMapper<ProductEntity, ProductDto> mapper)
        : base(repository, mapper)
    {
    }

    protected override Task ValidateSaveAsync(ProductEntity entity, CancellationToken ct)
    {
        if (string.IsNullOrWhiteSpace(entity.Name))
        {
            throw new InvalidOperationException("Product name is required.");
        }

        return Task.CompletedTask;
    }
}

Base CRUD methods already flow through IBeam service policy and audit behavior when configured.

Custom Service Operations

Custom methods should use IServiceOperationExecutor so auditing, permission evaluation, request context, actor context, and failure metadata are consistent.

[IBeamOperation("patients")]
public sealed class PatientService
{
    private readonly IServiceOperationExecutor _operations;

    public PatientService(IServiceOperationExecutor operations)
    {
        _operations = operations;
    }

    [IBeamOperation("patients.discharge")]
    public Task DischargeAsync(Guid patientId, CancellationToken ct = default)
    {
        return _operations.ExecuteAsync(
            this,
            async token =>
            {
                // Business rules and repository/service calls live here.
                await Task.CompletedTask;
            },
            new ServiceOperationExecutionOptions
            {
                EntityId = patientId
            },
            ct);
    }
}

Use OriginalData and TransformedData when a custom method changes data and you can provide before/after entity snapshots. Prefer database entity shapes, not decorated outbound DTOs.

Service Policy Configuration

Configuration section: IBeam:Services:Policies

{
  "IBeam": {
    "Services": {
      "Policies": {
        "Services": {
          "ProductsService": {
            "GetAll": true,
            "Save": true,
            "Delete": false
          }
        }
      }
    }
  }
}

Use service policies to disable risky operations without changing code, such as blocking deletes during an incident.

Audit Configuration

Configuration section: IBeam:Services:Audit

{
  "IBeam": {
    "Services": {
      "Audit": {
        "Enabled": true,
        "DefaultMode": "AuditWrites",
        "EnableSelectAudits": false,
        "SelectMode": "DailyRollup",
        "CaptureBefore": true,
        "CaptureAfter": true,
        "FailOnAuditError": false,
        "Services": {
          "ProductsService": {
            "EntityName": "products",
            "Operations": {
              "Save": {
                "Action": "products.save"
              },
              "Delete": {
                "Action": "products.delete"
              }
            }
          }
        }
      }
    }
  }
}

The audit hierarchy is broad default first, then service override, then operation override. That lets teams audit most services by default while turning specific services or methods off.

Data Storage

This package does not create audit tables by itself. It defines the audit contracts and execution hooks. Use IBeam.Services.Logging to write audit transactions to ILogger, repositories, or Azure Table Storage.

Extended Docs And Agent Guidance

Agents should make the service method the named operation boundary and keep API/repository layers thin.

Troubleshooting

Problem Likely Cause Fix
Custom method is not audited Method bypasses IServiceOperationExecutor Wrap the custom method body with the executor.
Operation name is missing [IBeamOperation] not applied Add class and/or method operation attributes.
Delete/save is unexpectedly blocked Service policy disabled the operation Check IBeam:Services:Policies.
Audit contains decorated DTOs API response model was passed as audit data Pass entity/database-shaped snapshots instead.

Version Notes

  • Targets net10.0.
  • Designed for both IBeam Identity and bring-your-own authentication.
  • Package version is assigned by the repository release workflow.
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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 (10)

Showing the top 5 NuGet packages that depend on IBeam.Services:

Package Downloads
IBeam.Identity.Services

IBeam modular framework components for .NET APIs and services.

IBeam.Services.Logging

IBeam modular framework components for .NET APIs and services.

IBeam.Services.AutoMapper

IBeam modular framework components for .NET APIs and services.

IBeam.Ai.Services

Agent tool registry, authorization, and MCP service orchestration for IBeam-backed applications.

IBeam.AccessControl.Services

Tenant resource access services and in-memory store for IBeam-backed applications.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.9.43 0 7/29/2026
2.9.1 187 7/23/2026
2.9.0 214 7/21/2026
2.8.2 210 7/21/2026
2.8.1 209 7/21/2026
2.8.0 213 7/21/2026
2.7.0 213 7/21/2026
2.6.0 217 7/20/2026
2.5.0 214 7/17/2026
2.4.2 141 7/16/2026
2.4.1 108 7/14/2026
2.4.0 131 6/24/2026
2.3.0 127 6/24/2026
2.2.0 129 6/23/2026
2.1.0 141 6/23/2026
2.0.68 124 6/23/2026
2.0.66 125 6/22/2026
2.0.65 132 6/22/2026
2.0.64 131 6/17/2026
2.0.63 138 6/16/2026
Loading failed