XMLopr xmlpro = new XMLopr();string xmlpath = WebConfigurationManager.AppSettings["fileinfo_Filexmlpath"].ToString();xmlpath = Server.MapPath(xmlpath);Dictionaryfiledmap = xmlpro.ReadXmlFiled(xmlpath);if (filedmap == null){result="读取字段匹配设置文档失败!";return result;}int i = 0;foreach (KeyValuePair keypair in filedmap){//获取值string value =dr[keypair.Key.Trim()]==null?"":dr[keypair.Key.Trim()].ToString().Trim();//获取映射字段string mapfiled = keypair.Value.Trim();//判断映射字段类型PropertyInfo property = fileModel.GetType().GetProperty(mapfiled);if (property.PropertyType.Name.ToLower().Equals("string")){property.SetValue(fileModel,value,null);}else if (property.PropertyType.Name.Equals("int32")){property.SetValue(fileModel, int.Parse(value), null);}else if (property.PropertyType.Name.Equals("DateTime")){if(value.Trim()!=string.Empty)property.SetValue(fileModel,DateTime.Parse(value), null);}}