Libation/_DB_NOTES.txt
Robert McRackan 9076fae6f6 - add retry logic to library get
- UI bug fix when no library yet
- publishing related xml added to data and UI projects
- 'how to publish' notes
2019-11-14 14:17:20 -05:00

44 lines
1.4 KiB
Plaintext

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
LocalDb
=======
SSMS db connection: (LocalDb)\MSSQLLocalDB
eg: Server=(localdb)\mssqllocaldb;Database=DataLayer.LibationContext;Integrated Security=true;
LocalDb database files live at:
C:\Users\[user]\DataLayer.LibationContext.mdf
C:\Users\[user]\DataLayer.LibationContext_log.ldf
Migrations
==========
Visual Studio, EF Core
----------------------
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
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
======
SQLite does not support all migrations (schema changes) due to limitations in SQLite
delete db before running Update-Database?