diff --git a/DataLayer/UNTESTED/LibationContextFactory.cs b/DataLayer/UNTESTED/LibationContextFactory.cs index 9f253569..73fad17f 100644 --- a/DataLayer/UNTESTED/LibationContextFactory.cs +++ b/DataLayer/UNTESTED/LibationContextFactory.cs @@ -6,6 +6,9 @@ namespace DataLayer public class LibationContextFactory : DesignTimeDbContextFactoryBase { protected override LibationContext CreateNewInstance(DbContextOptions options) => new LibationContext(options); - protected override void UseDatabaseEngine(DbContextOptionsBuilder optionsBuilder, string connectionString) => optionsBuilder.UseSqlServer(connectionString); + protected override void UseDatabaseEngine(DbContextOptionsBuilder optionsBuilder, string connectionString) => optionsBuilder + //.UseSqlServer + .UseSqlite + (connectionString); } } diff --git a/DataLayer/UNTESTED/Utilities/LocalDatabaseInfo.cs b/DataLayer/UNTESTED/Utilities/LocalDatabaseInfo.cs new file mode 100644 index 00000000..cab98cb7 --- /dev/null +++ b/DataLayer/UNTESTED/Utilities/LocalDatabaseInfo.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace DataLayer.Utilities +{ + public static class LocalDatabaseInfo + { + public static List GetLocalDBInstances() + { + // Start the child process. + using var p = new System.Diagnostics.Process + { + StartInfo = new System.Diagnostics.ProcessStartInfo + { + UseShellExecute = false, + RedirectStandardOutput = true, + FileName = "cmd.exe", + Arguments = "/C sqllocaldb info", + CreateNoWindow = true, + WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden + } + }; + p.Start(); + var output = p.StandardOutput.ReadToEnd(); + p.WaitForExit(); + + // if LocalDb is not installed then it will return that 'sqllocaldb' is not recognized as an internal or external command operable program or batch file + return string.IsNullOrWhiteSpace(output) || output.Contains("not recognized") + ? new List() + : output + .Split(new string[] { Environment.NewLine }, StringSplitOptions.None) + .Select(i => i.Trim()) + .Where(i => !string.IsNullOrEmpty(i)) + .ToList(); + } + } +} diff --git a/DataLayer/appsettings.json b/DataLayer/appsettings.json index 51c2ab56..d98c3023 100644 --- a/DataLayer/appsettings.json +++ b/DataLayer/appsettings.json @@ -1,6 +1,7 @@ { "ConnectionStrings": { - "LibationContext": "Server=(LocalDb)\\MSSQLLocalDB;Database=DataLayer.LibationContext;Integrated Security=true;", + "LibationContext_sqlserver": "Server=(LocalDb)\\MSSQLLocalDB;Database=DataLayer.LibationContext;Integrated Security=true;", + "LibationContext": "Data Source=LibationContext.db;Foreign Keys=False;", "// on windows sqlite paths accept windows and/or unix slashes": "", "MyTestContext": "Data Source=%DESKTOP%/sample.db" diff --git a/REFERENCE.txt b/REFERENCE.txt index 1a4d3d3c..e9ff2a08 100644 --- a/REFERENCE.txt +++ b/REFERENCE.txt @@ -1,6 +1,8 @@ -- begin VERSIONING --------------------------------------------------------------------------------------------------------------------- https://github.com/rmcrackan/Libation/releases +v3.0.3 : Switch to SQLite +v3.0.2 : Final using LocalDB v3.0.1 : Legacy inAudible wire-up code is still present but is commented out. All future check-ins are not guaranteed to have inAudible wire-up code v3.0 : This version is fully powered by the Audible API. Legacy scraping code is still present but is commented out. All future check-ins are not guaranteed to have any scraping code -- end VERSIONING --------------------------------------------------------------------------------------------------------------------- diff --git a/__TODO.txt b/__TODO.txt index b85ce95e..90e0da7f 100644 --- a/__TODO.txt +++ b/__TODO.txt @@ -13,7 +13,7 @@ only files: no mdf, ldf REPLACE DB -need completely need db? replace LocalDb with sqlite? embedded document nosql? +need completely new db? replace LocalDb with sqlite? embedded document nosql (LiteDB)? CREATE INSTALLER see REFERENCE.txt > HOW TO PUBLISH @@ -24,6 +24,7 @@ Warn of known performance issues - Tag add/edit - Grid is slow to respond loading when books aren't liberated - get decrypt key -- unavoidable +- images can take a bit to initially load. downloading is throttled as to not get the IP blocked by audible -- end BETA --------------------------------------------------------------------------------------------------------------------- -- begin ENHANCEMENT, IMPORT UI --------------------------------------------------------------------------------------------------------------------- @@ -124,6 +125,8 @@ move out of Book and into DtoMapper? Extract file and tag stuff from domain objects. This should exist only in data layer. If domain objects are able to call EF context, it should go through data layer Why are tags in file AND database? +why use a relational db? i'm treating it like a nosql db. use LiteDB instead? + extract FileManager dependency from data layer -- end TAGS ---------------------------------------------------------------------------------------------------------------------