Sfoglia il codice sorgente

Fixed problem with BaseStore not being used for unoverriden stores

Kenric Nugteren 6 mesi fa
parent
commit
61169604d3
1 ha cambiato i file con 3 aggiunte e 1 eliminazioni
  1. 3 1
      InABox.Database/DbFactory.cs

+ 3 - 1
InABox.Database/DbFactory.cs

@@ -44,6 +44,8 @@ public static class DbFactory
     
     
     public static string? ColorScheme { get; set; }
     public static string? ColorScheme { get; set; }
     public static byte[]? Logo { get; set; }
     public static byte[]? Logo { get; set; }
+
+    public static Type DefaultStore { get; set; } = typeof(Store<>);
     
     
     // See notes in Request.DatabaseInfo class
     // See notes in Request.DatabaseInfo class
     // Once RPC transport is stable, these settings need
     // Once RPC transport is stable, these settings need
@@ -351,7 +353,7 @@ public static class DbFactory
 
 
     public static IStore FindStore(Type type, Guid userguid, string userid, Platform platform, string version, Logger logger)
     public static IStore FindStore(Type type, Guid userguid, string userid, Platform platform, string version, Logger logger)
     {
     {
-        var defType = typeof(Store<>).MakeGenericType(type);
+        var defType = DefaultStore.MakeGenericType(type);
         Type? subType = Stores.Where(myType => myType.IsSubclassOf(defType)).FirstOrDefault();
         Type? subType = Stores.Where(myType => myType.IsSubclassOf(defType)).FirstOrDefault();
 
 
         var store = (Activator.CreateInstance(subType ?? defType) as IStore)!;
         var store = (Activator.CreateInstance(subType ?? defType) as IStore)!;