Ejemplo n.º 1
0
 public void SetParameter(string name, string value, QuoteStyle style)
 {
     if (style != QuoteStyle.NONE)
     {
         value = style.Convert(value);
     }
     items.Add(name, value);
     //parameterMap[name] = value;
 }
Ejemplo n.º 2
0
 public static string CreateItemString(List <String> data, QuoteStyle style)
 {
     return(data.Aggregate(new StringBuilder(), (result, item) =>
     {
         if (result.Length == 0)
         {
             return result.Append(style.Convert(item));
         }
         result.Append(LIST_ITEM_SEPARATOR).Append(style.Convert(item));
         return result;
     }).ToString());
 }
Ejemplo n.º 3
0
        public static string CreateMapString(Dictionary <String, String> data, QuoteStyle keyStyle, QuoteStyle valueStyle)
        {
            var mapData = new StringBuilder();

            foreach (KeyValuePair <String, String> element in data)
            {
                var itemString = keyStyle.Convert(element.Key) + "=" + valueStyle.Convert(element.Value);
                if (mapData.Length == 0)
                {
                    mapData.Append(itemString);
                }
                else
                {
                    mapData.Append(LIST_ITEM_SEPARATOR).Append(itemString);
                }
            }
            return(mapData.ToString());
        }
Ejemplo n.º 4
0
        private string HandleSide(Expression exp, QuoteStyle style, object obj)
        {
            if (exp is BinaryExpression)
            {
                return(Parse((BinaryExpression)exp, obj));
            }

            try
            {
                return(style.Convert(Expression.Lambda(exp).Compile().DynamicInvoke().ToString()));
            } catch (InvalidOperationException)
            {
                PropertyInfo prop = ((MemberExpression)exp).Member as PropertyInfo;
                if (Attribute.IsDefined(prop, typeof(LookupPropertyAttribute)) &&
                    Attribute.IsDefined(prop, typeof(IDColumnAttribute)) && obj != null)
                {
                    var    idData       = prop.GetCustomAttribute(typeof(IDColumnAttribute)) as IDColumnAttribute;
                    string propertyName = idData.ColumnName;
                    return(style.Convert((string)obj.GetType().GetProperty(propertyName).GetValue(obj)));
                }
                return(style.Convert(prop.Name));
            }
        }
Ejemplo n.º 5
0
 public void AddWhereFragment(string name, string value, QuoteStyle style)
 {
     customFragments.Add(String.Format(" WHERE \"{0}\"='{1}')", name, value));
 }