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

# ManagerBase

> Represents the base class for all EasyAF business logic managers. Provides access to a database context and message publishing capabilities for implementing ...

## Definition

**Assembly:** CloudNimble.EasyAF.Business.EF6.dll

**Namespace:** CloudNimble.EasyAF.Business

**Inheritance:** System.Object

## Syntax

```csharp theme={"dark"}
CloudNimble.EasyAF.Business.ManagerBase<TContext>
```

## Summary

Represents the base class for all EasyAF business logic managers. Provides access to a database context
and message publishing capabilities for implementing business operations and workflows.

## Remarks

This base class is designed to encapsulate business logic that requires database access and messaging capabilities.
It's particularly useful for implementing complex business processes such as user registration, order processing,
or any workflow that needs to coordinate database operations with message publishing for event-driven architectures.

## Type Parameters

* `TContext` - The type of the database context (DbContext) used for data operations.

## Examples

```csharp theme={"dark"}
public class UserRegistrationManager : ManagerBase&lt;MyDbContext&gt;
{
    public UserRegistrationManager(MyDbContext context, IMessagePublisher publisher)
        : base(context, publisher) { }

    public async Task&lt;User&gt; RegisterUserAsync(string email, string password)
    {
        var user = new User { Email = email, Password = HashPassword(password) };
        DataContext.Users.Add(user);
        await DataContext.SaveChangesAsync();

        await MessagePublisher.PublishAsync(new UserRegisteredEvent { UserId = user.Id });
        return user;
    }
}
```

## Constructors

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

Initializes a new instance of the `ManagerBase`1\` class.

#### Syntax

```csharp theme={"dark"}
public ManagerBase(TContext dataContext, CloudNimble.SimpleMessageBus.Publish.IMessagePublisher messagePublisher)
```

#### Parameters

| Name               | Type                                                     | Description                                                                                   |
| ------------------ | -------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| `dataContext`      | `TContext`                                               | The database context instance for data operations. Should be injected by the DI container.    |
| `messagePublisher` | `CloudNimble.SimpleMessageBus.Publish.IMessagePublisher` | The message publisher instance for publishing events. Should be injected by the DI container. |

### <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" /> DataContext

Gets the database context instance used for data operations.
This context is injected through the constructor and provides access to the database.

#### Syntax

```csharp theme={"dark"}
public TContext DataContext { get; private set; }
```

#### Property Value

Type: `TContext`

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

Gets the message publisher instance used for publishing events and messages to the message bus.
This publisher is injected through the constructor and enables event-driven architecture patterns.

#### Syntax

```csharp theme={"dark"}
public CloudNimble.SimpleMessageBus.Publish.IMessagePublisher MessagePublisher { get; private set; }
```

#### Property Value

Type: `CloudNimble.SimpleMessageBus.Publish.IMessagePublisher`

## Methods

### <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="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="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="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?`
