# Microsoft.EntityFrameworkCore.Tools

**Kind:** Service

**Source:** `Pams/API/Pams.API.Core/Pams.API.Core.csproj` (line 1)

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

NuGet package dependency

`Microsoft.EntityFrameworkCore.Tools` is a NuGet package dependency in `Pams.API.Core.csproj` that enables Entity Framework Core design-time commands. It supports workflows such as creating migrations and applying database updates through the `dotnet ef` command.

## Diagram

```mermaid
sequenceDiagram
    participant Developer
    participant CLI as dotnet ef
    participant Project as Pams.API.Core
    participant Tools as Microsoft.EntityFrameworkCore.Tools
    participant Database

    Developer->>CLI: Run migration command
    CLI->>Project: Load project configuration
    Project->>Tools: Resolve EF Core tooling
    Tools->>CLI: Execute migration operation
    CLI->>Database: Apply schema changes
```

## Usage

```ts
import { execFile } from "node:child_process";
import { promisify } from "node:util";

const execFileAsync = promisify(execFile);

await execFileAsync("dotnet", [
  "ef",
  "migrations",
  "add",
  "AddPamsSchema",
  "--project",
  "Pams/API/Pams.API.Core/Pams.API.Core.csproj",
]);

console.log("Migration created.");
```

## AI Coding Instructions

- Keep `Microsoft.EntityFrameworkCore.Tools` as a NuGet package reference in `Pams.API.Core.csproj` when Entity Framework Core CLI commands are required.
- Run `dotnet ef` commands against the project containing the Entity Framework Core configuration.
- Use migrations to track database schema changes rather than editing the database schema manually.
- If the startup project differs from `Pams.API.Core`, pass the appropriate `--startup-project` argument to `dotnet ef`.

## Used by

1 reference from 1 file. 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 (1)

- `Pams.API.Core` — `Pams/API/Pams.API.Core/Pams.API.Core.csproj`:1
