private Version QueryVersion() { try { using (var read = OpenReadContext()) { var broker = read.GetBroker <IPersistentStoreVersionBroker>(); var criteria = new PersistentStoreVersionSearchCriteria(); criteria.Major.SortDesc(0); criteria.Minor.SortDesc(1); criteria.Build.SortDesc(2); criteria.Revision.SortDesc(3); var versions = broker.Find(criteria); if (versions.Count == 0) { return(Assembly.GetExecutingAssembly().GetName().Version); } var version = CollectionUtils.FirstElement(versions); return(new Version( int.Parse(version.Major), int.Parse(version.Minor), int.Parse(version.Build), int.Parse(version.Revision))); } } catch (Exception e) { Platform.Log(LogLevel.Error, e); return(Assembly.GetExecutingAssembly().GetName().Version); } }
/// <summary> /// Copy constructor /// </summary> protected PersistentStoreVersionSearchCriteria(PersistentStoreVersionSearchCriteria other) : base(other) { }