Skip to content

Conversation

Loucif-Fouad
Copy link

No description provided.

This change adds support for the UniDAC database access components to the DMVC framework, mirroring the existing support for FireDAC.

A new conditional compilation symbol, `USE_UNIDAC`, has been introduced to enable the UniDAC implementation. When this symbol is defined, the framework uses UniDAC components (`TUniConnection`, `TUniQuery`, etc.) for database access.

A new sample project, `unidac_activerecord_showcase`, has been created to demonstrate and test the UniDAC integration. This sample is a modified version of the existing `activerecord_showcase` project.

The core `MVCFramework.ActiveRecord.pas` unit has been updated to include conditional code blocks that switch between FireDAC and UniDAC implementations. A new utility unit, `MVCFramework.UniDAC.Utils.pas`, has been added to provide helper functions for UniDAC.
This change adds support for the UniDAC database access components to the DMVC framework, mirroring the existing support for FireDAC.

A new conditional compilation symbol, `USE_UNIDAC`, has been introduced to enable the UniDAC implementation. When this symbol is defined, the framework uses UniDAC components (`TUniConnection`, `TUniQuery`, etc.) for database access.

A new sample project, `unidac_activerecord_showcase`, has been created to demonstrate and test the UniDAC integration. This sample is a modified version of the existing `activerecord_showcase` project.

The core `MVCFramework.ActiveRecord.pas` unit has been updated to include conditional code blocks that switch between FireDAC and UniDAC implementations. A new utility unit, `MVCFramework.UniDAC.Utils.pas`, has been added to provide helper functions for UniDAC.
This change adds support for the UniDAC database access components to the DMVC framework, mirroring the existing support for FireDAC.

A new conditional compilation symbol, `USE_UNIDAC`, has been introduced to enable the UniDAC implementation. When this symbol is defined, the framework uses UniDAC components (`TUniConnection`, `TUniQuery`, etc.) for database access.

A new sample project, `unidac_activerecord_showcase`, has been created to demonstrate and test the UniDAC integration. This sample is a modified version of the existing `activerecord_showcase` project.

The core `MVCFramework.ActiveRecord.pas` unit has been updated to include conditional code blocks that switch between FireDAC and UniDAC implementations. A new utility unit, `MVCFramework.UniDAC.Utils.pas`, has been added to provide helper functions for UniDAC.
This commit introduces the initial, work-in-progress implementation for UniDAC support in the ActiveRecord component.

Key changes include:
- Refactoring of MVCFramework.ActiveRecord.pas to introduce a TMVCActiveRecordBase class.
- Addition of a new MVCFramework.ActiveRecord.UniDAC.pas unit for the UniDAC-specific implementation.
- Creation of a new MVCFramework.UniDAC.Utils.pas unit.
- A new sample project, unidac_activerecord_showcase, to demonstrate usage.

Note: This implementation is currently incomplete and is not expected to compile. It is being committed to a feature branch to allow for collaborative testing and diagnosis of the remaining issues.
This commit fixes the issues identified in the previous code review and compilation attempt.

The main changes are:
- Completed the refactoring of `MVCFramework.ActiveRecord.pas`. The unit now has a clean separation between the generic `TMVCActiveRecordBase` and the FireDAC-specific implementation, which is wrapped in `{$IFDEF USE_FIREDAC}`.
- Corrected all generic constraints (e.g., for `TMVCUnitOfWork`) to use `TMVCActiveRecordBase`, making them DAC-agnostic.
- Removed duplicated type declarations and fixed other syntax errors that were causing compilation to fail.
This commit addresses the last remaining compilation errors in `MVCFramework.ActiveRecord.pas`.

- Changed `TMVCActiveRecordBase` from an `abstract class` to a concrete `class(TObject)` to prevent issues with RTTI and type definitions.
- Corrected the alias for `TMVCActiveRecord` for non-FireDAC builds to be a concrete descendant of `TMVCActiveRecordBase`, which resolves the "not completely defined" and "redeclaration" compiler errors.
This commit applies a series of fixes to the `MVCFramework.ActiveRecord.pas` unit to resolve the compilation errors reported after the initial refactoring.

The main changes include:
- Corrected the `TMVCActiveRecordBase` definition to be a concrete class.
- Resolved a type redeclaration issue with the `TMVCActiveRecord` alias.
- Fixed an incorrect method call in `InternalSelectRQL` (changed `Where` to `Select`).
- Replaced a call to `GetEnumName` with a local helper function to avoid RTTI issues.
- Correctly implemented the `SelectDataSet` functionality in the base and FireDAC-specific classes.
As per the new strategy, this commit converts the ActiveRecord-related parts of the framework to be UniDAC-only, removing all FireDAC dependencies from the source files.

Key changes:
- `MVCFramework.ActiveRecord.pas` has been refactored to use UniDAC components (`TUniConnection`, `TUniQuery`, etc.) directly.
- `MVCFramework.FireDAC.Utils.pas` has been renamed to `MVCFramework.UniDAC.Utils.pas` and its content has been converted to use UniDAC.
- Other related framework units (`ActiveRecordController`, `Middleware.ActiveRecord`) have been cleaned of FireDAC dependencies.

This provides a clean, UniDAC-only baseline for further development and testing. The next step will be to re-introduce FireDAC support using conditional compilation.
This commit corrects an error where a non-existent class, `TUniMemTable`, was used.

Based on user feedback, all instances of `TUniMemTable` have been replaced with the correct UniDAC in-memory dataset component, `TVirtualTable`. The `uses` clause has also been updated to include the `VirtualTable` unit instead of `MemDS`.
This commit fixes the final compilation errors reported by the user in `MVCFramework.UniDAC.Utils.pas`.

- Replaced the call to the non-existent `CreateDataSet` method with `Open` to correctly initialize the in-memory `TVirtualTable`.
- Replaced the call to the non-existent `CopyFrom` method with `Assign` to correctly copy data from a source dataset.
It also adds a new sample project `unidac_activerecord_showcase` which is a converted version of the `activerecord_showcase` to demonstrate the usage of the UniDAC-only framework.

This is the first step towards adding multi-component support (FireDAC and UniDAC). The next step will be to re-introduce FireDAC support using conditional compilation.
This is the first step in adding UniDAC support to the framework.
As per the agreed strategy, the entire framework and the relevant sample project have been converted to use UniDAC exclusively.

The following changes were made:
- All FireDAC dependencies in the core framework have been replaced with their UniDAC equivalents.
- The `MVCFramework.ActiveRecord.pas` unit has been completely converted to UniDAC.
- A new `MVCFramework.UniDAC.Utils.pas` unit has been introduced.
- The `MVCFramework.Middleware.ActiveRecord.pas` has been updated to use UniDAC.
- The `activerecord_showcase` sample has been renamed to `unidac_activerecord_showcase` and converted to use UniDAC.

This version is now ready for testing. The next step will be to re-introduce FireDAC support using conditional compilation.
@danieleteti danieleteti self-assigned this Sep 12, 2025
@danieleteti
Copy link
Owner

danieleteti commented Sep 12, 2025

Thanks for your contribution.

  • Do all the unit tests pass correctly?
  • When in "FIREDAC MODE" does it compile correctly (no hints,no warnings) in a machine where UniDAC is not available at all?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants