Become a member!

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 Refresh for nullable types
  • Improved error messages for duplicated connection names
  • Reverted to historical behavior: TMVCActiveRecord.Create uses LazyConnection by 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 utf8 accepted like utf-8 in content type
  • Improved TryFindSessionByID using 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

  1. Add explicit session middleware if you use sessions
  2. Review session-related code for compatibility
  3. If using database sessions, create the dmvc_session table


← Back to DMVCFramework

Comments

comments powered by Disqus