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

# InitCommand

> Command for initializing EasyAF project configuration including database scaffolding, project types, and analyzer setup.

## Definition

**Assembly:** CloudNimble.EasyAF.Tools.dll

**Namespace:** CloudNimble.EasyAF.Tools.Commands

**Inheritance:** CloudNimble.EasyAF.Tools.Commands.EasyAFBaseCommand

## Syntax

```csharp theme={"dark"}
CloudNimble.EasyAF.Tools.Commands.InitCommand
```

## Summary

Command for initializing EasyAF project configuration including database scaffolding, project types, and analyzer setup.

## Constructors

### <Icon icon="hammer" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> .ctor

Initializes a new instance of the [InitCommand](/api-reference/CloudNimble/EasyAF/Tools/Commands/InitCommand) class.

#### Syntax

```csharp theme={"dark"}
public InitCommand(CloudNimble.EasyAF.EFCoreToEdmx.EdmxConfigManager configManager)
```

#### Parameters

| Name            | Type                                                | Description                        |
| --------------- | --------------------------------------------------- | ---------------------------------- |
| `configManager` | `CloudNimble.EasyAF.EFCoreToEdmx.EdmxConfigManager` | The configuration manager service. |

### <Icon icon="hammer" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> .ctor <Badge color="gray">Inherited</Badge>

<Note>Inherited from `CloudNimble.EasyAF.Tools.Commands.EasyAFBaseCommand`</Note>

#### Syntax

```csharp theme={"dark"}
protected EasyAFBaseCommand()
```

### <Icon icon="hammer" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> .ctor <Badge color="gray">Inherited</Badge>

<Note>Inherited from `object`</Note>

#### Syntax

```csharp theme={"dark"}
public Object()
```

## Properties

### <Icon icon="tag" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> ConnectionString

Gets or sets the connection string source.

#### Syntax

```csharp theme={"dark"}
public string ConnectionString { get; set; }
```

#### Property Value

Type: `string`

### <Icon icon="tag" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> ContextName

Gets or sets the DbContext class name.

#### Syntax

```csharp theme={"dark"}
public string ContextName { get; set; }
```

#### Property Value

Type: `string`

### <Icon icon="tag" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> DbContextNamespace

Gets or sets the namespace for the generated DbContext.

#### Syntax

```csharp theme={"dark"}
public string DbContextNamespace { get; set; }
```

#### Property Value

Type: `string`

### <Icon icon="tag" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> ExcludeTables

Gets or sets the tables to exclude.

#### Syntax

```csharp theme={"dark"}
public string[] ExcludeTables { get; set; }
```

#### Property Value

Type: `string[]`

### <Icon icon="tag" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> NoDataAnnotations

Gets or sets a value indicating whether to disable data annotations.

#### Syntax

```csharp theme={"dark"}
public bool NoDataAnnotations { get; set; }
```

#### Property Value

Type: `bool`

### <Icon icon="tag" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> NoPluralize

Gets or sets a value indicating whether to disable pluralization.

#### Syntax

```csharp theme={"dark"}
public bool NoPluralize { get; set; }
```

#### Property Value

Type: `bool`

### <Icon icon="tag" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> ObjectsNamespace

Gets or sets the namespace for the generated entity objects.

#### Syntax

```csharp theme={"dark"}
public string ObjectsNamespace { get; set; }
```

#### Property Value

Type: `string`

### <Icon icon="tag" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> Provider

Gets or sets the database provider.

#### Syntax

```csharp theme={"dark"}
public string Provider { get; set; }
```

#### Property Value

Type: `string`

### <Icon icon="tag" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> SimpleMessageBusProject

Gets or sets the SimpleMessageBus project name to create. If specified, creates a new SimpleMessageBus project.

#### Syntax

```csharp theme={"dark"}
public string SimpleMessageBusProject { get; set; }
```

#### Property Value

Type: `string`

### <Icon icon="tag" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> SolutionFolder

Gets or sets the working directory for the solution. Defaults to current directory.

#### Syntax

```csharp theme={"dark"}
public string SolutionFolder { get; set; }
```

#### Property Value

Type: `string`

### <Icon icon="tag" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> Tables

Gets or sets the specific tables to include.

#### Syntax

```csharp theme={"dark"}
public string[] Tables { get; set; }
```

#### Property Value

Type: `string[]`

## Methods

### <Icon icon="thumbtack" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> CheckMSBuildRegistered <Badge color="gray">Inherited</Badge>

<Note>Inherited from `CloudNimble.EasyAF.Tools.Commands.EasyAFBaseCommand`</Note>

Ensures MSBuild is registered with the latest available version.

#### Syntax

```csharp theme={"dark"}
protected static void CheckMSBuildRegistered()
```

### <Icon icon="thumbtack" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> ConfigureDirectoryBuildProps <Badge color="gray">Inherited</Badge>

<Note>Inherited from `CloudNimble.EasyAF.Tools.Commands.EasyAFBaseCommand`</Note>

Configures Directory.Build.props with EasyAF namespace, UserSecretsId, and analyzer references using MSBuildProjectManager.

#### Syntax

```csharp theme={"dark"}
protected static void ConfigureDirectoryBuildProps(string commonNamespace, string userSecretsId, string[] projectFiles)
```

#### Parameters

| Name              | Type       | Description                  |
| ----------------- | ---------- | ---------------------------- |
| `commonNamespace` | `string`   | The common namespace to set. |
| `userSecretsId`   | `string`   | The UserSecretsId to set.    |
| `projectFiles`    | `string[]` | Array of project file paths. |

### <Icon icon="thumbtack" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> ConfigureProjectTypes <Badge color="gray">Inherited</Badge>

<Note>Inherited from `CloudNimble.EasyAF.Tools.Commands.EasyAFBaseCommand`</Note>

Discovers and configures project types and namespace for all projects in the current directory and subdirectories.

#### Syntax

```csharp theme={"dark"}
protected static void ConfigureProjectTypes(string userSecretsId)
```

#### Parameters

| Name            | Type     | Description                                        |
| --------------- | -------- | -------------------------------------------------- |
| `userSecretsId` | `string` | The UserSecretsId to set in Directory.Build.props. |

### <Icon icon="thumbtack" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> DetectCommonNamespace <Badge color="gray">Inherited</Badge>

<Note>Inherited from `CloudNimble.EasyAF.Tools.Commands.EasyAFBaseCommand`</Note>

Detects the common namespace from existing projects.

#### Syntax

```csharp theme={"dark"}
protected static string DetectCommonNamespace(string[] projectFiles)
```

#### Parameters

| Name           | Type       | Description                  |
| -------------- | ---------- | ---------------------------- |
| `projectFiles` | `string[]` | Array of project file paths. |

#### Returns

Type: `string`
The detected common namespace, or null if none found.

### <Icon icon="thumbtack" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> DetermineProjectType <Badge color="gray">Inherited</Badge>

<Note>Inherited from `CloudNimble.EasyAF.Tools.Commands.EasyAFBaseCommand`</Note>

Determines the EasyAFProjectType based on the project file name and content.

#### Syntax

```csharp theme={"dark"}
protected static string DetermineProjectType(string projectFilePath)
```

#### Parameters

| Name              | Type     | Description                   |
| ----------------- | -------- | ----------------------------- |
| `projectFilePath` | `string` | The path to the project file. |

#### Returns

Type: `string`
The determined project type, or null if no supported type is detected.

### <Icon icon="code-fork" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> Equals <Badge color="gray">Inherited</Badge> <Badge color="orange">Virtual</Badge>

<Note>Inherited from `object`</Note>

#### Syntax

```csharp theme={"dark"}
public virtual bool Equals(object obj)
```

#### Parameters

| Name  | Type      | Description |
| ----- | --------- | ----------- |
| `obj` | `object?` | -           |

#### Returns

Type: `bool`

### <Icon icon="thumbtack" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> Equals <Badge color="gray">Inherited</Badge>

<Note>Inherited from `object`</Note>

#### Syntax

```csharp theme={"dark"}
public static bool Equals(object objA, object objB)
```

#### Parameters

| Name   | Type      | Description |
| ------ | --------- | ----------- |
| `objA` | `object?` | -           |
| `objB` | `object?` | -           |

#### Returns

Type: `bool`

### <Icon icon="thumbtack" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> ExtractUserSecretsId <Badge color="gray">Inherited</Badge>

<Note>Inherited from `CloudNimble.EasyAF.Tools.Commands.EasyAFBaseCommand`</Note>

Extracts the UserSecretsId from a project file using MSBuild evaluation.
This will properly evaluate the project with all imports including Directory.Build.props.

#### Syntax

```csharp theme={"dark"}
protected static string ExtractUserSecretsId(string projectFilePath)
```

#### Parameters

| Name              | Type     | Description                   |
| ----------------- | -------- | ----------------------------- |
| `projectFilePath` | `string` | The path to the project file. |

#### Returns

Type: `string`
The UserSecretsId if found, otherwise null.

### <Icon icon="thumbtack" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> ExtractUserSecretsIdFromDataProject <Badge color="gray">Inherited</Badge>

<Note>Inherited from `CloudNimble.EasyAF.Tools.Commands.EasyAFBaseCommand`</Note>

Extracts the UserSecretsId from the data project folder.

#### Syntax

```csharp theme={"dark"}
protected static string ExtractUserSecretsIdFromDataProject(string dataFolder)
```

#### Parameters

| Name         | Type     | Description                   |
| ------------ | -------- | ----------------------------- |
| `dataFolder` | `string` | The data project folder path. |

#### Returns

Type: `string`
The UserSecretsId if found, otherwise null.

### <Icon icon="thumbtack" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> ExtractUserSecretsIdFromDirectoryBuildProps <Badge color="gray">Inherited</Badge>

<Note>Inherited from `CloudNimble.EasyAF.Tools.Commands.EasyAFBaseCommand`</Note>

Extracts the UserSecretsId from Directory.Build.props in the current directory.

#### Syntax

```csharp theme={"dark"}
protected static string ExtractUserSecretsIdFromDirectoryBuildProps()
```

#### Returns

Type: `string`
The UserSecretsId if found, otherwise null.

### <Icon icon="thumbtack" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> FindCommonPrefix <Badge color="gray">Inherited</Badge>

<Note>Inherited from `CloudNimble.EasyAF.Tools.Commands.EasyAFBaseCommand`</Note>

Finds the common prefix among a list of strings.

#### Syntax

```csharp theme={"dark"}
protected static string FindCommonPrefix(System.Collections.Generic.List<string> strings)
```

#### Parameters

| Name      | Type                                      | Description                                    |
| --------- | ----------------------------------------- | ---------------------------------------------- |
| `strings` | `System.Collections.Generic.List<string>` | The list of strings to find common prefix for. |

#### Returns

Type: `string`
The common prefix.

### <Icon icon="code-fork" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> GetHashCode <Badge color="gray">Inherited</Badge> <Badge color="orange">Virtual</Badge>

<Note>Inherited from `object`</Note>

#### Syntax

```csharp theme={"dark"}
public virtual int GetHashCode()
```

#### Returns

Type: `int`

### <Icon icon="function" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> GetType <Badge color="gray">Inherited</Badge>

<Note>Inherited from `object`</Note>

#### Syntax

```csharp theme={"dark"}
public System.Type GetType()
```

#### Returns

Type: `System.Type`

### <Icon icon="function" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> MemberwiseClone <Badge color="gray">Inherited</Badge>

<Note>Inherited from `object`</Note>

#### Syntax

```csharp theme={"dark"}
protected internal object MemberwiseClone()
```

#### Returns

Type: `object`

### <Icon icon="function" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> OnExecuteAsync

Executes the init command.

#### Syntax

```csharp theme={"dark"}
public System.Threading.Tasks.Task<int> OnExecuteAsync()
```

#### Returns

Type: `System.Threading.Tasks.Task<int>`
Exit code.

### <Icon icon="thumbtack" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> ReferenceEquals <Badge color="gray">Inherited</Badge>

<Note>Inherited from `object`</Note>

#### Syntax

```csharp theme={"dark"}
public static bool ReferenceEquals(object objA, object objB)
```

#### Parameters

| Name   | Type      | Description |
| ------ | --------- | ----------- |
| `objA` | `object?` | -           |
| `objB` | `object?` | -           |

#### Returns

Type: `bool`

### <Icon icon="thumbtack" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> SetProjectType <Badge color="gray">Inherited</Badge>

<Note>Inherited from `CloudNimble.EasyAF.Tools.Commands.EasyAFBaseCommand`</Note>

Adds or updates the EasyAFProjectType property in a project file using MSBuildProjectManager.

#### Syntax

```csharp theme={"dark"}
protected static void SetProjectType(string projectFilePath, string projectType)
```

#### Parameters

| Name              | Type     | Description                   |
| ----------------- | -------- | ----------------------------- |
| `projectFilePath` | `string` | The path to the project file. |
| `projectType`     | `string` | The project type to set.      |

### <Icon icon="thumbtack" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> SetUserSecretAsync <Badge color="gray">Inherited</Badge>

<Note>Inherited from `CloudNimble.EasyAF.Tools.Commands.EasyAFBaseCommand`</Note>

Sets a user secret value using the official dotnet user-secrets CLI tool.

#### Syntax

```csharp theme={"dark"}
protected static System.Threading.Tasks.Task SetUserSecretAsync(string userSecretsId, string key, string value, string projectPath)
```

#### Parameters

| Name            | Type     | Description                 |
| --------------- | -------- | --------------------------- |
| `userSecretsId` | `string` | The user secrets ID.        |
| `key`           | `string` | The secret key.             |
| `value`         | `string` | The secret value.           |
| `projectPath`   | `string` | The project directory path. |

#### Returns

Type: `System.Threading.Tasks.Task`

### <Icon icon="code-fork" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> ToString <Badge color="gray">Inherited</Badge> <Badge color="orange">Virtual</Badge>

<Note>Inherited from `object`</Note>

#### Syntax

```csharp theme={"dark"}
public virtual string ToString()
```

#### Returns

Type: `string?`
