protected override ThingGraphContent OpenInternal(Iori source) { var gateway = new Limaki.Data.db4o.Gateway(); try { gateway.Open(source); var sink = new ThingGraphContent { Data = new ThingGraph(gateway), Source = source, ContentType = Db4oThingGraphSpot.Db4oThingGraphContentType, }; return(sink); } catch (DatabaseFileLockedException ex) { throw; } catch (Exception ex) { if (ex.InnerException != null && ex.InnerException is DatabaseFileLockedException) { throw ex.InnerException; } else { var olderVersion = ProveIfOlderVersion(gateway); if (olderVersion != null) { throw new NotSupportedException(olderVersion, ex); } else { throw; } } } }
protected virtual string ProveIfOlderVersion(Limaki.Data.db4o.Gateway gateway) { var repairer = new Db4oRepairer(); var clazzes = repairer.ClazzNames(gateway); var name = (from clazz in clazzes from field in clazz.Item2 where field == "_writeDate" select field).FirstOrDefault(); if (name != null) { return("Database seems created with an older version. Please import into a new database."); } return(null); }