ATTENTION
I've used these instructions successfully in the past. They did not work for contributor in Oct 2025. It's possible they're out of date. If you find a better process, please update this file.




Migrations, quick
=================
View > Other Windows > Package Manager Console
Default project: DataLayer
Startup project: DataLayer
since we have mult contexts, must use -context:
    Add-Migration MyComment -context LibationContext
    Update-Database -context LibationContext
Startup project: reset to prev. eg: LibationWinForms


Migrations, detailed
====================
if only 1 context present, can omit -context arg:
    Add-Migration MyComment
    Update-Database


Migrations, errors
=================
if add-migration xyz throws and error, don't take the error msg at face value. try again with add-migration xyz -verbose

ERROR:    Add-Migration : The term 'Add-Migration' is not recognized as the name of a cmdlet, function, script file, or operable program
SOLUTION: add nuget pkg: Microsoft.EntityFrameworkCore.Tools


SqLite config
=============
relative:
    optionsBuilder.UseSqlite("Data Source=blogging.db");
absolute  (use fwd slashes):
    optionsBuilder.UseSqlite("Data Source=C:/foo/bar/blogging.db");


Logging/Debugging (EF CORE)
===========================
Once you configure logging on a DbContext instance it will be enabled on all instances of that DbContext type
    using var context = new MyContext();
    context.ConfigureLogging(s => System.Diagnostics.Debug.WriteLine(s)); // write to Visual Studio "Output" tab
    //context.ConfigureLogging(s => Console.WriteLine(s));
see comments at top of file:
    Dinah.EntityFrameworkCore\DbContextLoggingExtensions.cs
