This project has moved and is read-only. For the latest updates, please go here.

Closed file when using ElevatedTrustDriver

Jun 27, 2013 at 9:51 PM
Edited Jul 2, 2013 at 11:40 AM
I'm trying to use sterling db in a silverlight project I've been successful at using the isolatedStorage even though I have a problem for more than one instance (That's another story (

I'm trying to use the ElevatedTrustDriver like so:
   var folder = (Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\MyApp\\").Replace("\\","/");
    ElevatedTrustDriver driver = new ElevatedTrustDriver(folder);
    Database = _engine.SterlingDatabase.RegisterDatabase<OURInternalDB>(driver);
But when trying to save new data
  var key = SterlingService.InstanceSterlingService.Database.Save<AppConfiguration>(config);
An exception shows up with the following text:

System.ObjectDisposedException was unhandled by user code
Message=Cannot access a closed file.
ObjectName="" StackTrace: at System.IO.__Error.FileNotOpen() at System.IO.FileStream.Write(Byte[] array, Int32 offset, Int32 count) at System.IO.BinaryWriter.Write(Byte[] buffer) at Wintellect.Sterling.ElevatedTrust.ElevatedTrustDriver.Save(Type type, Int32 keyIndex, Byte[] bytes) at Wintellect.Sterling.Database.BaseDatabaseInstance.Save(Type actualType, Type tableType, Object instance, CycleCache cache) at Wintellect.Sterling.Database.BaseDatabaseInstance.Save(Type type, Object instance) at Wintellect.Sterling.Database.BaseDatabaseInstance.Save[T](T instance) at Waf.App.LoadDefaultData.LoadData() at Waf.App.MainPage..ctor() at Waf.App.App.Application_Startup(Object sender, StartupEventArgs e) at MS.Internal.CoreInvokeHandler.InvokeEventHandler(UInt32 typeIndex, Delegate handlerDelegate, Object sender, Object args) at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags) InnerException:

I'vent been able to found a reference to this on sterling documentation.

Any guidance will be appreciated
Sep 26, 2013 at 4:22 AM