Bounded Context: Configuration
Aggregate Root: FeatureFlag
Module: Ums.Domain.Configuration.FeatureFlag
Status: Production
The FeatureFlag aggregate controls runtime feature enablement in a simplified but operationally useful way. It stores a technical flag code, flag type, target definition, optional linked resource targeting, rollout percentage, and state transitions across inactive, active, and archived states.
FeatureFlag is the aggregate root. State transitions and evaluation behavior are coordinated through the aggregate.
RolloutPercentage between 0 and 100.Inactive.| Entity / VO | Type | Ownership |
|—|—|—|
| FeatureFlagId | Value Object | Aggregate identifier |
| FlagType | Enumeration | Current rollout category |
| FlagStatus | Enumeration | Inactive, Active, Archived |
| LinkedResourceType | Enumeration | Optional scoping target |
| FlagEvaluationLog | Entity | Aggregate-owned evaluation history |
| Event | Trigger |
|—|—|
| FeatureFlagCreatedEvent | New flag created |
| FeatureFlagActivatedEvent | Flag activated |
| FeatureFlagDeactivatedEvent | Flag deactivated |
| FeatureFlagArchivedEvent | Flag archived |
| FeatureFlagStateChangedEvent | State transition emitted |
| FlagEvaluatedEvent | Runtime evaluation executed |
FeatureFlag (Aggregate Root)
├── Props: FeatureFlagProps
│ ├── Id: IdValueObject
│ ├── FlagCode: string
│ ├── FlagType: FlagType
│ ├── FlagTargets: string
│ ├── Status: FlagStatus
│ ├── LinkedResourceType?: LinkedResourceType
│ ├── LinkedResourceId?: IdValueObject
│ ├── RolloutPercentage?: int
│ └── Audit: AuditValueObject
└── Children
└── IReadOnlyCollection<FlagEvaluationLog>
classDiagram
class FeatureFlag {
+Guid Id
+string FlagCode
+FlagType FlagType
+string FlagTargets
+FlagStatus Status
+LinkedResourceType LinkedResourceType
+Guid LinkedResourceId
+int RolloutPercentage
+List~FlagEvaluationLog~ EvaluationLog
+Create(flagCode, flagType, flagTargets, linkedResourceType, linkedResourceId, rolloutPercentage, actor)
+Activate(actor)
+Deactivate(actor)
+Archive(actor)
+Evaluate(evaluatedBy, context)
}
sequenceDiagram
participant C as Caller
participant F as FeatureFlag (AR)
C->>F: Evaluate(evaluatedBy, context)
F->>F: Validate not archived
F->>F: Resolve result from current status
F->>F: Append FlagEvaluationLog
F->>F: Raise FlagEvaluatedEvent
erDiagram
FEATURE_FLAG ||--o{ FLAG_EVALUATION_LOG : "records"
FEATURE_FLAG {
uniqueidentifier Id PK
nvarchar FlagCode
int FlagTypeId
nvarchar FlagTargets
int StatusId
int LinkedResourceTypeId
uniqueidentifier LinkedResourceId
int RolloutPercentage
nvarchar CreatedBy
datetime2 CreatedAtUtc
nvarchar UpdatedBy
datetime2 UpdatedAtUtc
nvarchar AuditTimeSpan
}
TenantId directly on the aggregate.LinkedResourceType and LinkedResourceId.