コード例 #1
0
        public static bool TryCreate(IRowVersion rowVersion, out string eTag)
        {
            if (rowVersion == null)
            {
                throw new ArgumentNullException("rowVersion");
            }


            eTag = null;
            if (rowVersion != null)
            {
                eTag = BitHelper.ConvertToHex(rowVersion.RowVersion);
            }
            return(eTag != null);
        }
コード例 #2
0
        public static bool TryCreate(IPreconditionInformation info, out string eTag)
        {
            if (info == null)
            {
                throw new ArgumentNullException("info");
            }


            eTag = null;
            if (info.RowVersion != null && info.RowVersion.Length > 0)
            {
                eTag = BitHelper.ConvertToHex(info.RowVersion);
            }
            else
            {
                eTag = BitHelper.ConvertToHex(info.ModifiedOn);
            }
            return(eTag != null);
        }
コード例 #3
0
        public static bool TryCreate(IEnumerable <IModifiedTimestamp> modifiableItems, out string eTag)
        {
            if (modifiableItems == null)
            {
                throw new ArgumentNullException(nameof(modifiableItems));
            }


            if (modifiableItems.Any())
            {
                // In a collection, only the most recent modified date is interesting.

                eTag = BitHelper.ConvertToHex(modifiableItems.Max(i => i.ModifiedOn));
                return(true);
            }
            else
            {
                eTag = null;
                return(false);
            }
        }
コード例 #4
0
 public static bool TryCreate(DateTimeOffset timestamp, out string eTag)
 {
     eTag = BitHelper.ConvertToHex(timestamp);
     return(true);
 }