# System.Xml.Linq

**Kind:** Service

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

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

NuGet package dependency

`System.Xml.Linq` is a NuGet package dependency declared by the `Pams.CurrencyConverter` project. It contains LINQ-to-XML types that currency-converter code can use to read, query, and write XML data; callers interact with the converter service rather than this package directly.

## Diagram

```mermaid
sequenceDiagram
    participant Client
    participant Converter as Pams.CurrencyConverter
    participant Xml as System.Xml.Linq

    Client->>Converter: Send currency conversion request
    Converter->>Xml: Load and query XML data
    Xml-->>Converter: Return XML elements and values
    Converter-->>Client: Return conversion result
```

## Usage

```ts
type ConversionResult = {
  from: string;
  to: string;
  amount: number;
  convertedAmount: number;
};

async function convertCurrency(
  from: string,
  to: string,
  amount: number,
): Promise<ConversionResult> {
  const response = await fetch("/api/currency-converter/convert", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ from, to, amount }),
  });

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

  return response.json();
}

const result = await convertCurrency("USD", "EUR", 100);
console.log(result.convertedAmount);
```

## AI Coding Instructions

- Keep `System.Xml.Linq` referenced through the `Pams.CurrencyConverter.csproj` project dependency.
- Use LINQ-to-XML types such as `XDocument` and `XElement` inside the .NET converter implementation, not in TypeScript clients.
- Do not expose XML document types through service contracts; return DTOs or JSON responses to callers.
- Validate XML structure and missing element values before using them for currency conversion logic.
- Preserve the existing project-file package format when editing this legacy-format dependency.

## Used by

6 references from 6 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 (6)

- `Pams.Core` — `Pams/Core/Pams.Core/Pams.Core.csproj`:1
- `Pams.Security` — `Pams/Core/Pams.Security/Pams.Security.csproj`:1
- `Pams.Data` — `Pams/Data/Pams.Data/Pams.Data.csproj`:1
- `HelperTool` — `Pams/HelperTool/HelperTool.csproj`:1
- `Pams.Business` — `Pams/Logic/Pams.Business/Pams.Business.csproj`:1
- `Pams.CurrencyConverter` — `Pams/Logic/Pams.CurrencyConverter/Pams.CurrencyConverter.csproj`:1
