示例#1
0
        internal void Validate(int index, SyncColumnMapping item)
        {
            if (item == null)
            {
                throw SyncExpt.ArgumentNull("item");
            }
            if (item.Parent != null && this != item.Parent)
            {
                throw SyncExpt.Argument("", "item.Parent");
            }
            string serverColumn1 = item.ServerColumn;

            if (SyncUtil.IsEmpty(serverColumn1))
            {
                index = 1;
                string serverColumn2;
                do
                {
                    serverColumn2 = "ServerColumn" + index.ToString((IFormatProvider)CultureInfo.InvariantCulture);
                    ++index;
                }while (-1 != this.IndexOfServerColumn(serverColumn2));
                item.ServerColumn = serverColumn2;
            }
            else
            {
                this.ValidateServerColumn(index, serverColumn1);
            }
            string clientColumn = item.ClientColumn;

            this.ValidateClientColumn(index, clientColumn);
        }
示例#2
0
 /// <summary>
 /// Searches for a <see cref="T:Microsoft.Synchronization.Data.Server.SyncColumnMapping"/> object when given a column name. Returns the zero-based index of the first occurrence within the entire collection.
 /// </summary>
 ///
 /// <returns>
 /// The index position of <paramref name="serverColumn"/> if that string is found. Returns -1 if the string is not found.
 /// </returns>
 /// <param name="serverColumn">The name of the column at the server for which to get the index in the <see cref="T:Microsoft.Synchronization.Data.Server.SyncColumnMappingCollection"/>.</param>
 public int IndexOfServerColumn(string serverColumn)
 {
     if (!SyncUtil.IsEmpty(serverColumn))
     {
         int count = this.Count;
         for (int index = 0; index < count; ++index)
         {
             if (serverColumn == this.Items[index].ServerColumn)
             {
                 return(index);
             }
         }
     }
     return(-1);
 }
示例#3
0
 /// <summary>
 /// Searches for a <see cref="T:Microsoft.Synchronization.Data.Server.SyncColumnMapping"/> object when given a column name, and returns the zero-based index of the first occurrence within the entire collection.
 /// </summary>
 ///
 /// <returns>
 /// The index position of <paramref name="clientColumn"/> if that string is found; otherwise -1 if it is not.
 /// </returns>
 /// <param name="clientColumn">The name of the column at the client for which to get the index in the <see cref="T:Microsoft.Synchronization.Data.Server.SyncColumnMappingCollection"/>.</param>
 public int IndexOfClientColumn(string clientColumn)
 {
     if (!SyncUtil.IsEmpty(clientColumn))
     {
         int count = this.Count;
         for (int index = 0; index < count; ++index)
         {
             if (clientColumn == this.Items[index].ClientColumn)
             {
                 return(index);
             }
         }
     }
     return(-1);
 }
示例#4
0
        internal static string BuildQuotedString(string quotePrefix, string quoteSuffix, string unQuotedString)
        {
            StringBuilder stringBuilder = new StringBuilder();

            if (!SyncUtil.IsEmpty(quotePrefix))
            {
                stringBuilder.Append(quotePrefix);
            }
            if (!SyncUtil.IsEmpty(quoteSuffix))
            {
                stringBuilder.Append(unQuotedString.Replace(quoteSuffix, quoteSuffix + quoteSuffix));
                stringBuilder.Append(quoteSuffix);
            }
            else
            {
                stringBuilder.Append(unQuotedString);
            }
            return(((object)stringBuilder).ToString());
        }