Ejemplo n.º 1
0
        private IDictionary <string, object> GetConDic(FilterObject fo)
        {
            var type = fo.Cons.GetType();

            Utility.IPropertyGetter pg;
            if (type.Equals(typeof(ExpandoObject)))
            {
                pg = new Utility.ExpandoPorpertyGetter();
            }
            else
            {
                pg = new Utility.NormalPorpertyGetter();
            }
            return(pg.GetPropertyDic(fo.Cons));
        }
Ejemplo n.º 2
0
        private string GenExpandoUpdateParaString(ExpandoObject obj)
        {
            var ret     = new StringBuilder();
            var i       = 1;
            var pg      = new Utility.ExpandoPorpertyGetter();
            var paraDic = pg.GetPropertyDic(obj);

            foreach (var key in paraDic.Keys)
            {
                ret.Append(" " + key + "=@" + key + " ");
                if (i < paraDic.Keys.Count)
                {
                    ret.Append(" , ");
                    i++;
                }
            }
            return(ret.ToString());
        }
Ejemplo n.º 3
0
        private void setProValueToDynPara(DynamicParameters dp, Object o)
        {
            Type type = o.GetType();

            if (type.Equals(typeof(ExpandoObject)))
            {
                var pg      = new Utility.ExpandoPorpertyGetter();
                var paraDic = pg.GetPropertyDic(o);
                foreach (var key in paraDic.Keys)
                {
                    dp.Add("@" + key, paraDic[key]);
                }
            }
            else
            {
                IList <PropertyInfo> props = new List <PropertyInfo>(type.GetProperties());
                foreach (PropertyInfo prop in props)
                {
                    object propValue = prop.GetValue(o, null);
                    dp.Add("@" + prop.Name, propValue);
                }
            }
        }