> ## Documentation Index
> Fetch the complete documentation index at: https://ai.easyaf.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# ModelBuilder

> Extension methods for ModelBuilder from Microsoft.EntityFrameworkCore

## Definition

**Assembly:** Microsoft.EntityFrameworkCore.dll

**Namespace:** Microsoft.EntityFrameworkCore

## Syntax

```csharp theme={null}
Microsoft.EntityFrameworkCore.ModelBuilder
```

## Summary

This type is defined in Microsoft.EntityFrameworkCore.

## Remarks

See [Microsoft documentation](https://learn.microsoft.com/dotnet/api/microsoft.entityframeworkcore.modelbuilder) for more information about the rest of the API.

## Methods

### &#x20;AddMcpTasksTable Extension

> [!NOTE]
>
> Extension method from `Microsoft.EntityFrameworkCore.McpEssentials_EntityFrameworkCore_ModelBuilderExtensions`

Maps [McpTaskEntity](https://ai.easyaf.dev/mcpessentials/api-reference/CloudNimble/McpEssentials/EntityFrameworkCore/Tasks/McpTaskEntity.md) to table `McpTasks`. Call from the host
`OnModelCreating`.

#### Syntax

```csharp theme={null}
public static Microsoft.EntityFrameworkCore.ModelBuilder AddMcpTasksTable(Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `modelBuilder` | `Microsoft.EntityFrameworkCore.ModelBuilder` | The model builder for the host context. |

#### Returns

Type: `Microsoft.EntityFrameworkCore.ModelBuilder`
The same *modelBuilder*.

#### Exceptions

| Exception | Description |
| - | - |
| `ArgumentNullException` | Thrown when *modelBuilder* is [`null`](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null). |

#### Remarks

Use this when the project that owns the [DbContext](https://learn.microsoft.com/dotnet/api/microsoft.entityframeworkcore.dbcontext) already references this
package. Mapping lives with the rest of the model. Use
`DbContextOptionsBuilder.AddMcpTasksTable` from `AddDbContext` when the context
type lives in a library that must not reference this package. Pick one.

### &#x20;AddMcpTasksTable Extension

> [!NOTE]
>
> Extension method from `Microsoft.EntityFrameworkCore.McpEssentials_EntityFrameworkCore_ModelBuilderExtensions`

Maps [McpTaskEntity](https://ai.easyaf.dev/mcpessentials/api-reference/CloudNimble/McpEssentials/EntityFrameworkCore/Tasks/McpTaskEntity.md) to *tableName* in
*schema*. Call from the host `OnModelCreating`.

#### Syntax

```csharp theme={null}
public static Microsoft.EntityFrameworkCore.ModelBuilder AddMcpTasksTable(Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder, string tableName, string schema = null)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `modelBuilder` | `Microsoft.EntityFrameworkCore.ModelBuilder` | The model builder for the host context. |
| `tableName` | `string` | The table name. |
| `schema` | `string?` | The schema, or [`null`](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) for the database default. |

#### Returns

Type: `Microsoft.EntityFrameworkCore.ModelBuilder`
The same *modelBuilder*.

#### Exceptions

| Exception | Description |
| - | - |
| `ArgumentNullException` | Thrown when *modelBuilder* is [`null`](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null). |
| `ArgumentException` | Thrown when *tableName* is [`null`](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) or whitespace. |

#### Remarks

Use this when the project that owns the [DbContext](https://learn.microsoft.com/dotnet/api/microsoft.entityframeworkcore.dbcontext) already references this
package. Mapping lives with the rest of the model. Use
`DbContextOptionsBuilder.AddMcpTasksTable` from `AddDbContext` when the context
type lives in a library that must not reference this package. Pick one.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.