0

我们正在使用 sterling 开发一个浏览器外应用程序,我们有以下场景:

  1. 该应用程序可以使用快捷方式打开
  2. 如果我们打开编辑文件(具有特定扩展名),应用程序就会打开。

问题是在案例 2 中打开的实例似乎具有不同的 IsolatedStorage 并且没有共享数据,因此我们尝试执行以下操作

 var folder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\MyApp\\";
 IsolatedStorageDriver driver = new IsolatedStorageDriver(folder,true);
        driver.DatabaseName = "sterling";
        Database = _engine.SterlingDatabase.RegisterDatabase<OurInternalDB>(driver);

这会产生以下异常:

System.ArgumentOutOfRangeException 未被用户代码处理 Message=Specified 参数超出了有效值的范围。参数名称:basePath StackTrace:在 Wintellect.Sterling.IsolatedStorage.PathProvider._ContractForBasePath(String basePath) 在 Wintellect.Sterling.IsolatedStorage.PathProvider.GetKeysPath(String basePath, String databaseName, Type tableType, ISterlingDriver driver) 在 Wintellect.Sterling.IsolatedStorage。在 Wintellect.Sterling.Keys.KeyCollection 2._DeserializeKeys() at Wintellect.Sterling.Keys.KeyCollection2..ctor(ISterlingDriver 驱动程序,Func 2 resolver) at Wintellect.Sterling.Database.TableDefinition2..ctor(ISterlingDriver 驱动程序,Func2 resolver, Func2 键)在 Wintellect.Sterling.Database.BaseDatabaseInstance.PublishTables(ISterlingDriver) 在 Waf.Dal.Sterling.Database.OURInternalDB.RegisterTables() 的 Wintellect.Sterling.Database.BaseDatabaseInstance.CreateTableDefinition[T,TKey](Func`2 keyFunction) driver) at Wintellect.Sterling.Database.SterlingDatabase.RegisterDatabase[T](ISterlingDriver driver) at Waf.Dal.SterlingService.Starting() at Waf.Dal.Factory.Sterling.InitializeDatabase() at Waf.Dal.AireaStorageHelper.InitializeDatabase( ) 在 Waf.App.App..ctor() 内部异常:

更新:我试图替换文件夹值

var folder = (Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\MyApp\\").Replace("\\","/"); 

异常消失了,但我原来的问题仍然存在,就像应用程序的 2 个实例使用不同的隔离存储一样。

4

1 回答 1

1

当我进行更新时,这解决了隔离存储驱动程序的问题:

var folder = (Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\MyApp\\").Replace("\\","/"); 

但是,我了解到隔离存储不会在同一应用程序的实例之间共享。

希望这对某人有用

于 2013-07-02T14:07:32.247 回答