Skip to content

Remove NoTransientInstancesOfPersistentClass conditional define #38

@bero

Description

@bero

Summary

The NoTransientInstancesOfPersistentClass conditional define should be removed and the check should always be enforced.

Background

Currently, creating transient instances of persistent classes is conditionally prevented via {$IFDEF NoTransientInstancesOfPersistentClass} in BoldSystem.pas. This define is enabled under the Attracs configuration but disabled otherwise.

Problem

There is no valid use case for creating transient instances of persistent classes:

  • Temporary objects can use undo/rollback or separate DTO classes
  • Preview/simulation scenarios should use separate in-memory systems
  • Template objects can be stored in DB or use non-persistent classes

The conditional define:

  • Implies the feature might be useful (it isn't)
  • Allows bugs in builds without the define
  • Adds unnecessary complexity
  • The AddTransientFromSystem procedure in BoldObjectListControllers.pas becomes dead code

Proposed Solution

  1. Remove {$DEFINE NoTransientInstancesOfPersistentClass} from Bold.inc
  2. Remove {$UNDEF NoTransientInstancesOfPersistentClass} from non-Attracs block
  3. Make the check in BoldSystem.pas unconditional
  4. Remove dead code AddTransientFromSystem from BoldObjectListControllers.pas
  5. Update tests that relied on this feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions