# EntityFramework.SqlServer

**Kind:** Service

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

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

NuGet package dependency

`EntityFramework.SqlServer` is a NuGet package dependency in `Pams.API` that connects Entity Framework data access code to SQL Server. It supports SQL Server database configuration, query execution, and persistence for API services that use Entity Framework.

## Diagram

```mermaid
sequenceDiagram
    participant Client
    participant Api as Pams.API
    participant EF as Entity Framework
    participant SqlServer as SQL Server

    Client->>Api: Send API request
    Api->>EF: Query or save entity
    EF->>SqlServer: Execute SQL command
    SqlServer-->>EF: Return data or result
    EF-->>Api: Map result to entity
    Api-->>Client: Return API response
```

## Usage

```ts
const response = await fetch("/api/pams");

if (!response.ok) {
  throw new Error("Pams API request failed");
}

const records = await response.json();

console.log(records);
```

## AI Coding Instructions

- Keep `EntityFramework.SqlServer` aligned with the Entity Framework version referenced by `Pams.API`.
- Configure the SQL Server connection through the API application's database context and configuration files.
- Use Entity Framework queries and persistence methods instead of building SQL strings in API controllers.
- Check package compatibility before changing Entity Framework or SQL Server dependency versions.
