# Generating the C# a native provider implements

> Writes the C# interface, and the plain classes it carries, for a seam a native .NET provider implements — `IBlobStore`, `IEntitySource`, `IWritableEntitySource` or `IExportSink` — exactly as this platform declares it, stamped with the seam hash the platform checks. A seam that extends another is written with it: generate the one you implement.

<!-- id: local-generating-a-seam · area: local · stability: preview · html: https://osysharp.com/reference/local/generating-a-seam/ -->

## Summary        {#summary}

A provider is normally Osy#: a class in a package that implements a seam. When what it needs cannot be reached from
Osy# — a vendor driver with no HTTP API, a proprietary library — it can be written in C# instead, against the same seam.
`osy seam generate` writes that seam as C#: the interface and every class it carries, with the platform's documentation,
stamped with the seam's hash.

## Signature      {#signature}

```console
osy seam generate <interface> [-o <file>] [--json]
```

## Description    {#description}

### What it writes   {#writes}

The seam as this platform declares it in Osy#, read from the platform itself — no repository, no account. A method
that answers nothing returns `Task`, one that answers a value `Task<T>`, and one that streams `IAsyncEnumerable<T>`;
every method takes a trailing `CancellationToken`. The classes a seam carries — a query plan, a batch of changes — are
plain classes of text, numbers, bools, dates, ids, `byte[]`, enums, lists and string-keyed dictionaries.

Without `-o` the C# is printed; with it, written to the file. `--json` prints the seam, its hash and the file.

The file is self-contained. It declares the `[SeamHash]` attribute beside the seam, so the provider's project references
nothing of the platform's: compile it into the project that implements the seam.

### The seam hash   {#hash}

The interface carries `[SeamHash("…")]`: a hash of every member's name, type and default in the Osy# declaration, and
of nothing a comment says. A provider built against one hash is refused by a platform whose seam has another, naming
the package, the seam and both hashes — before it serves anything. So regenerate after upgrading the toolchain, and
rebuild the provider.

### Where a native provider may run   {#where}

Native code runs on dedicated and self-hosted platforms, where the only tenant it can affect is the one who chose it. A
package ships the assembly with its manifest's `native` role and declares the class as a [native class](https://osysharp.com/reference/class/native/).
A deploy to shared hosting refuses a native package, naming the tiers that run it.

## Examples       {#examples}

```console
osy seam generate IEntitySource -o src/Seams/EntitySource.g.cs
```

```console
osy seam generate IBlobStore --json
```

## See also       {#see-also}
- [data held somewhere else (app.DataSources)](https://osysharp.com/reference/config/data-sources/) — the seam a data source implements
- [data sent somewhere else, as it changes (app.Exports)](https://osysharp.com/reference/config/exports/) — the seam an export sink implements
- [The local loop (running your app on your own machine)](https://osysharp.com/reference/local/index/) — the other commands of the local toolchain
