# MiniProfiler

**Kind:** Service

**Source:** `Pams/Logic/Pams.Business/Pams.Business.csproj` (line 1)

**Part of:** [Pams](subsystem-pams)

NuGet package dependency

MiniProfiler is a NuGet package dependency declared in `Pams.Business.csproj`. It supports profiling instrumentation around work performed by the `Pams.Business` project and is configured through the .NET application hosting this project.

## Diagram

```mermaid
sequenceDiagram
    participant App as .NET Application
    participant Business as Pams.Business
    participant Profiler as MiniProfiler

    App->>Profiler: Start profiling scope
    App->>Business: Execute business operation
    Business->>Profiler: Record profiled operation
    Business-->>App: Return operation result
    App->>Profiler: Complete profiling scope
```

## Usage

```ts
// MiniProfiler is configured in the .NET host.
// Client code can include the profiler identifier when it is returned by the API.

type ApiResponse<T> = {
  data: T;
  profilerId?: string;
};

async function loadBusinessData(): Promise<ApiResponse<unknown>> {
  const response = await fetch("/api/business-data");
  const profilerId = response.headers.get("X-MiniProfiler-Ids");

  return {
    data: await response.json(),
    profilerId: profilerId ?? undefined,
  };
}
```

## AI Coding Instructions

- Keep MiniProfiler package configuration in the .NET project that hosts `Pams.Business`.
- Add profiling scopes around business operations where timing information is needed.
- Do not add client-side dependencies for MiniProfiler unless the host exposes profiler data to the client.
- Check package version and configuration compatibility before changing the legacy project file.

## Used by

2 references from 2 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

### Injected or called by (2)

- `Pams.API` — `Pams/API/Pams.API/Pams.API.csproj`:1
- `Pams.Business` — `Pams/Logic/Pams.Business/Pams.Business.csproj`:1
