I am traying to add SQLite support for database. I did some experiments. But I can't get over a problem.I would like to explain some parts of my work. Please help with SQLite support
MaintanceController.cs
line 296
if (_db.Database.ProviderName != "Microsoft.EntityFrameworkCore.Sqlite") model.DatabaseSize = Convert.ToInt64(mbSize * 1024 * 1024); else model.DatabaseSize = Convert.ToInt64(mbSize);
DataProvider.cs
line 306 and 319
if (Database.ProviderName == "Microsoft.EntityFrameworkCore.Sqlite") return Database.ExecuteSqlRawAsync($"DELETE FROM {tableName}"); else return Database.ExecuteSqlRawAsync($"TRUNCATE TABLE {tableName}");
InstallController.cs
line 80
new SelectListItem { Value = "sqlite", Text = T("UseSqlite"), Selected = isWindows },
DbFactory.cs
line 75
case "sqlite": assemblyName = "Smartstore.Data.Sqlite.dll"; break;
DataSettings.cs
line 198
case "sqlite": assemblyName = "Smartstore.Data.Sqlite.dll"; break;
DbServiceCollectionExtensions.cs
line 33
.AddSQLite()
SmartDbContext.cs
line onmodelcreating
modelBuilder.ApplyConfigurationsFromAssembly(Assembly.GetExecutingAssembly()); if (Database.ProviderName == "Microsoft.EntityFrameworkCore.Sqlite") { foreach (var entityType in modelBuilder.Model.GetEntityTypes()) { /* */ //foreach (var property in entityType.ClrType.GetProperties().Where(p => p.GetSetMethod(true) != null && (p.PropertyType == typeof(bool) || p.PropertyType == typeof(bool?)))) // modelBuilder.Entity(entityType.Name).Property(property.Name).HasConversion<BoolToZeroOneConverter<int>>(); foreach (var property in entityType.ClrType.GetProperties().Where(p => p.PropertyType == typeof(Decimal) || p.PropertyType == typeof(Decimal?))) modelBuilder.Entity(entityType.Name).Property(property.Name).HasConversion<double>(); //foreach (var property in entityType.ClrType.GetProperties().Where(p => p.PropertyType == typeof(UInt64) || p.PropertyType == typeof(UInt64?))) // modelBuilder.Entity(entityType.Name).Property(property.Name).HasConversion<double>(); foreach (var property in entityType.ClrType.GetProperties().Where(p => p.PropertyType == typeof(DateTimeOffset))) modelBuilder.Entity(entityType.Name).Property(property.Name).HasConversion<DateTime>(); foreach (var property in entityType.ClrType.GetProperties().Where(p => p.PropertyType == typeof(DateTimeOffset?))) modelBuilder.Entity(entityType.Name).Property(property.Name).HasConversion<DateTime?>(); foreach (var property in entityType.ClrType.GetProperties().Where(p => p.PropertyType == typeof(TimeSpan))) modelBuilder.Entity(entityType.Name).Property(property.Name).HasConversion<long>(); foreach (var property in entityType.ClrType.GetProperties().Where(p => p.PropertyType == typeof(TimeSpan?))) modelBuilder.Entity(entityType.Name).Property(property.Name).HasConversion<long?>(); } }