コード例 #1
0
    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;
      }
    }
コード例 #2
0
        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);
            }
        }