Ejemplo n.º 1
0
        /// <summary>
        ///     转换成Json格式 x=x&x=x
        /// </summary>
        /// <param name="dic">Dictionary对象</param>
        /// <typeparam name="T1">Key</typeparam>
        /// <typeparam name="T2">Value</typeparam>
        public static string ToJson <T1, T2>(this Dictionary <T1, T2> dic)
        {
            var sp = new StrPlus();

            foreach (var item in dic)
            {
                sp += string.Format("{0}={1}&", item.Key, item.Value);
            }
            return(sp.DelLastChar("&"));
        }
Ejemplo n.º 2
0
        public virtual string GetFields()
        {
            if (SelectString.Length > 0)
            {
                return(SelectString.ToString());
            }

            var str = new StrPlus();

            foreach (var item in Map.ModelList.Where(o => o.Value.IsDbField))
            {
                if (!dbProvider.IsField(item.Value.Column.Name))
                {
                    str += item.Value.Column.Name + " as " + item.Key.Name + ",";
                    continue;
                }
                str += dbProvider.CreateTableAegis(item.Value.Column.Name) + ",";
            }
            return(str.Value.IsNullOrEmpty() ? "*" : str.DelLastChar(","));
        }