好记性不如烂笔头。

利用反射通过参数给实体类属性赋值

  Alipay a = new Alipay();
        PropertyInfo[] pis = a.GetType().GetProperties();
        string[] paras = Request.QueryString.AllKeys;
        if (paras.Length > 0)
        {
            for (int i = 0; i < paras.Length; i++)
            {
                foreach (PropertyInfo pi in pis)
                {
                    if (pi.Name.ToLower() == paras[i].ToLower())
                    {
                        PropertyInfo pi2 = a.GetType().GetProperty(pi.Name);
                        pi2.SetValue(a,Request.QueryString[paras[i]]);
                    }
                }
            }

        }
        pis = a.GetType().GetProperties();
        foreach (PropertyInfo pi in pis)
        {
            Response.Write(pi.Name+": "+pi.GetValue(a,null)+"<br />");
        }