Esempio n. 1
0
 private void StoreConfiguration(ConfigurationCache cache)
 {
     try
     {
         var formatter = new BinaryFormatter();
         using (var stream = UserFolder.CreateFile(UserFolder.DataModelFile))
         {
             formatter.Serialize(stream, cache.Hash);
             formatter.Serialize(stream, cache.Configuration);
         }
     }
     catch (SerializationException e)
     {
         //Note: This can happen when multiple processes/AppDomains try to save
         //      the cached configuration at the same time. Only one concurrent
         //      writer will win, and it's harmless for the other ones to fail.
         for (Exception scan = e; scan != null; scan = scan.InnerException)
         {
             Logger.Warning("Error storing new NHibernate cache configuration: {0}", scan.Message);
         }
     }
 }