/// <summary> /// adds entity to the list of entity types /// </summary> /// <param name="entity"></param> public static void AddEntityType(Entity.Entity entity) { // adds this entity type to the list of entity types if (!EntityTypes.ContainsKey(entity.GetType().UnderlyingSystemType)) { EntityTypes.Add(entity.GetType().UnderlyingSystemType, entity.EntityData); } }
/// <summary> /// POST方式调用API方法 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="methodAddress"></param> /// <param name="entity">参数实体对象</param> /// <returns></returns> public static T CallAPIInPOST <T>(string methodAddress, Entity.Entity entity) { Type t = entity.GetType(); PropertyInfo[] propList = t.GetProperties().Where(d => d.CanWrite).ToArray(); Dictionary <string, string> paramsList = new Dictionary <string, string>() { }; foreach (var item in propList) { object value = item.GetValue(entity); paramsList.Add(item.Name, value == null ? string.Empty : value.ToString()); } return(CallAPIInPOST <T>(methodAddress, paramsList)); }