public override CompositeItemVersion AddVersion(int number) { // this logic was copied from SqlDataProvider implementation in 8.0 Update-3 var versionsList = this.GetVersions(); lock (versionsList) { var newNumber = versionsList.Count == 0 ? 1 : versionsList.Max(x => x.Number) + 1; if (number > 0) { var existingVersion = versionsList.SingleOrDefault(x => x.Number == number); if (existingVersion == null) { return null; } return existingVersion.CreateFrom(existingVersion, newNumber); } var version = new JsonVersion(newNumber); version.Fields[FieldIDs.Created.ToString()] = DateUtil.IsoNowWithTicks; versionsList.Add(version); return version; } }
public override CompositeItemVersion AddVersion(int number) { // this logic was copied from SqlDataProvider implementation in 8.0 Update-3 var versionsList = this.GetVersions(); lock (versionsList) { var newNumber = versionsList.Count == 0 ? 1 : versionsList.Max(x => x.Number) + 1; if (number > 0) { var existingVersion = versionsList.SingleOrDefault(x => x.Number == number); if (existingVersion == null) { return(null); } return(existingVersion.CreateFrom(existingVersion, newNumber)); } var version = new JsonVersion(newNumber); version.Fields[FieldIDs.Created.ToString()] = DateUtil.IsoNowWithTicks; versionsList.Add(version); return(version); } }