Reverting migration notes from #1402

This commit is contained in:
Robert
2025-11-03 10:21:13 -05:00
parent 09ca419faf
commit 0c512162ab
4 changed files with 60 additions and 0 deletions

View File

@@ -23,6 +23,12 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<None Update="migrate.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>embedded</DebugType>

View File

@@ -0,0 +1,5 @@
{
"ConnectionStrings": {
"LibationContext": "Data Source=LibationContext.db;Foreign Keys=False;"
}
}

View File

@@ -10,6 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Solution Items", "_Solutio
Upgrading dotnet version.txt = Upgrading dotnet version.txt
_ARCHITECTURE NOTES.txt = _ARCHITECTURE NOTES.txt
_AvaloniaUI Primer.txt = _AvaloniaUI Primer.txt
_DB_NOTES.txt = _DB_NOTES.txt
__README - COLLABORATORS.txt = __README - COLLABORATORS.txt
EndProjectSection
EndProject

48
Source/_DB_NOTES.txt Normal file
View File

@@ -0,0 +1,48 @@
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