DMVCFramework 3.4.2-magnesium - What's New
DMVCFramework 3.4.2-magnesium
Release Date: February 14, 2024
This release introduces a completely redesigned session system based on middleware architecture, with support for database-backed sessions.
Major New Features
Middleware-Based Session System
Breaking Change: Sessions are now middleware-based and no longer handled by the DMVCFramework core itself.
Benefits:
- Cleaner separation of concerns
- Pluggable session storage backends
- Better testability
- More flexible configuration
// Add session middleware
Engine.AddMiddleware(
TMVCSessionMiddleware.Create(
TMVCSessionFactory.GetInstance.CreateFileBasedSession
)
);
Database Session Storage
Store sessions in your database for distributed environments:
- PostgreSQL support
- MySQL/MariaDB support
- Firebird support
- SQL Server support
-- Create session table (PostgreSQL)
CREATE TABLE dmvc_session (
session_id VARCHAR(255) PRIMARY KEY,
session_data TEXT,
created_at TIMESTAMP,
updated_at TIMESTAMP
);
Session Storage Options
| Storage | Use Case |
|---|---|
| Memory | Development, single server |
| File-based | Single server, persistence |
| Database | Distributed, load-balanced |
Other Improvements
MVCActiveRecord Enhancements
- New constructor allowing specific connection per instance
- Fixed subtle bug in
Refreshfor nullable types - Improved error messages for duplicated connection names
- Reverted to historical behavior:
TMVCActiveRecord.CreateusesLazyConnectionby default
Middleware Improvements
- CORS middleware now allows PATCH method by default
- Session middleware supports HttpOnly cookies
Delphi Tokyo Compatibility
- Multiple compatibility fixes for Delphi 10.2 Tokyo
- Fixed inline variable usage in for-in loops
Bug Fixes
- Fixed
utf8accepted likeutf-8in content type - Improved
TryFindSessionByIDusing count instead of loading full object - Fixed JWT custom data sample
Breaking Changes
⚠️ Session System Redesign
Sessions are now middleware-based. Update your code:
Before (3.4.1):
// Sessions handled automatically by core
After (3.4.2):
// Add session middleware explicitly
Engine.AddMiddleware(TMVCSessionMiddleware.Create(...));
Upgrade Guide
- Add explicit session middleware if you use sessions
- Review session-related code for compatibility
- If using database sessions, create the
dmvc_sessiontable
Comments
comments powered by Disqus