> For the complete documentation index, see [llms.txt](https://docs.flexbase.in/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flexbase.in/flexbase-mcp-ai-prompts/domain-original-names-prompts.md).

# Domain Original Names Prompts

> **Standalone prompt for applying `[Table]` and `[Column]` EF Core annotations to domain models.**\
> Use this when the user wants to map FlexBase domain models back to their original database table and column names — enabling EF Core migrations to generate the correct schema.
>
> **This is separate from the main implementation completion workflow** — it can be run independently on any FlexBase domain model project that has extraction JSON with `originalName` / `sourceTable` metadata.

## When to Use

* **Legacy migrations** — keeping the original database schema so existing data doesn't require restructuring
* **Brownfield projects** — new FlexBase API layer on top of an existing database
* **Database-first scenarios** — FlexBase domain models must match an existing schema exactly
* **Post-implementation** — can be applied at any time after domain models are generated

## How to Use

Copy-paste any prompt below into your AI agent chat:

**Apply all original names:**

```
Apply original database names to the domain models
```

**Explicit Table/Column request:**

```
Add [Table] and [Column] attributes from the extraction JSON
```

**Legacy schema mapping:**

```
Map domain models to their legacy database schema
```

**EF Core annotation shorthand:**

```
Add EF Core annotations for the original table and column names
```

***

## What It Does

The agent reads the extraction JSON (`*_DomainServices.json`) and applies:

1. **`[Table("name", Schema = "schema")]`** to each domain model class based on `metadata.sourceTable`
2. **`[Column("originalName")]`** to each property where the original column name differs from the property name
3. **FK type fixes** — ensures all foreign key properties are `string` type (not int/Guid)
4. **C# keyword handling** — properties renamed to avoid C# keywords get `[Column]` to preserve the original name
5. **Build verification** — 0 errors after all annotations applied

**Prerequisites:** Domain model `.cs` files must exist (generated by FlexBase Studio) and extraction JSON must contain `originalName` / `sourceTable` metadata.

***

## Related

* **Full implementation completion:** [Implementation Completion](/flexbase-mcp-ai-prompts/implementation-completion-prompts.md)
* **Legacy migration extraction:** [Legacy Migration → Markdown](/flexbase-mcp-ai-prompts/legacy-migration-prompts-md-file.md)
