Fase 3b: de Hero bewaart zijn foto's in de bibliotheektabel (schakelaar uit), HeroImages blijft een kopie, controle bij het opstarten, FK-migratie met Down
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
|
||||
namespace SlpModularCms.Modules.Hero.Data;
|
||||
|
||||
/// <summary>
|
||||
/// Where the hero's photos are stored (media library phase 3b). Off (default): the hero's own table <c>HeroImages</c>. On
|
||||
/// (<c>Media__Library__HeroPhotosInLibrary=true</c>): the library's <c>MediaAssets</c> table (rows of module <c>hero</c>), with
|
||||
/// <c>HeroImages</c> kept up to date as a safety net so the switch can go back. The choice is made when the application starts.
|
||||
/// </summary>
|
||||
public sealed record HeroStorage(bool PhotosInLibrary);
|
||||
|
||||
/// <summary>EF builds the model once per key: the two storage modes have different models.</summary>
|
||||
public sealed class HeroModelCacheKeyFactory : IModelCacheKeyFactory
|
||||
{
|
||||
public object Create(DbContext context, bool designTime)
|
||||
=> (context.GetType(), context is HeroDbContext { PhotosInLibrary: true }, designTime);
|
||||
}
|
||||
Reference in New Issue
Block a user