# EntityBase

**Kind:** Class

**Source:** `Pams/Logic/Pams.Business/Entity/EntityBase.cs` (line 103)

**Part of:** [Pams](subsystem-pams)

`EntityBase` is a shared model class that tracks whether an entity has an associated object through `HasObject` and whether it is marked for deletion through `MarkDeleted`. Business-layer entity types can inherit or compose this state when applying persistence and deletion rules.

## Diagram

```mermaid
graph LR
    Entity[EntityBase]
    HasObject[HasObject: bool]
    MarkDeleted[MarkDeleted: bool]

    Entity --> HasObject
    Entity --> MarkDeleted
    MarkDeleted --> DeletionFlow[Deletion handling]
    HasObject --> ObjectState[Associated object state]
```

## Usage

```ts
// TypeScript representation of the EntityBase state sent to or received from .NET.
type EntityBase = {
  HasObject: boolean;
  MarkDeleted: boolean;
};

const entity: EntityBase = {
  HasObject: true,
  MarkDeleted: false,
};

function shouldPersist(entity: EntityBase): boolean {
  return entity.HasObject && !entity.MarkDeleted;
}

if (shouldPersist(entity)) {
  console.log("Entity can be processed.");
}
```

## AI Coding Instructions

- Keep `HasObject` and `MarkDeleted` as boolean state fields when extending entity models.
- Treat `MarkDeleted` as deletion state; do not assume the entity has already been removed from storage.
- Check `HasObject` before performing operations that require an associated object.
- Preserve field names when mapping this model to API payloads or client-side TypeScript types.

## Used by

355 references from 355 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

### Imported by (355)

- `PersonUserBindingModel` — `Pams/Logic/Pams.Business/BindingModels/Security/PersonUserBindingModel.cs`:7
- `AccountManagerTarget` — `Pams/Logic/Pams.Business/Entity/BookingTarget/AccountManagerTarget.cs`:7
- `ForecastedBookingRule` — `Pams/Logic/Pams.Business/Entity/BookingTarget/ForecastedBookingRule.cs`:7
- `MonthlyBacklog` — `Pams/Logic/Pams.Business/Entity/BookingTarget/MonthlyBacklog.cs`:7
- `MonthlyForecast` — `Pams/Logic/Pams.Business/Entity/BookingTarget/MonthlyForecast.cs`:7
- `MonthlyProductTypeBacklog` — `Pams/Logic/Pams.Business/Entity/BookingTarget/MonthlyProductTypeBacklog.cs`:7
- `MonthlySalesForecast` — `Pams/Logic/Pams.Business/Entity/BookingTarget/MonthlySalesForecast.cs`:7
- `MonthlyTarget` — `Pams/Logic/Pams.Business/Entity/BookingTarget/MonthlyTarget.cs`:7

…and 347 more.
