# System.Data.Linq

**Kind:** Service

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

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

NuGet package dependency

`System.Data.Linq` is a NuGet package dependency declared for the `Pams.Data` project in `Pams/Data/Pams.Data/Pams.Data.csproj`. It supports the data layer's LINQ to SQL integration and is consumed by .NET code rather than directly by TypeScript or JavaScript.

## Diagram

```mermaid
sequenceDiagram
    participant App as Application
    participant Data as Pams.Data
    participant Linq as System.Data.Linq
    participant Db as Database

    App->>Data: Request data operation
    Data->>Linq: Build and execute LINQ query
    Linq->>Db: Send translated SQL
    Db-->>Linq: Return query results
    Linq-->>Data: Materialize .NET objects
    Data-->>App: Return data result
```

## Usage

```ts
import { readFileSync } from "node:fs";
import { resolve } from "node:path";

const projectPath = resolve("Pams/Data/Pams.Data/Pams.Data.csproj");
const projectFile = readFileSync(projectPath, "utf8");

const hasSystemDataLinq =
  projectFile.includes('Include="System.Data.Linq"') ||
  projectFile.includes('PackageReference Include="System.Data.Linq"');

if (!hasSystemDataLinq) {
  throw new Error(
    "System.Data.Linq is not declared in the Pams.Data project file."
  );
}

console.log("System.Data.Linq dependency is declared.");
```

## AI Coding Instructions

- Keep `System.Data.Linq` references inside the .NET data layer; TypeScript and JavaScript code should access data through an application API.
- Preserve the existing legacy project dependency format when editing `Pams.Data.csproj`.
- Check for both assembly references and `PackageReference` entries when validating this dependency.
- Avoid changing LINQ to SQL mappings or query behavior without checking the database schema and calling code.
