| | |
| | | /// <param name="removeNotContains">ç§»é¤ä¸åå¨å段</param> |
| | | /// <param name="removerKey">ç§»é¤ä¸»é®</param> |
| | | /// <returns></returns> |
| | | public static string ValidateDicInEntity(this Type typeinfo, Dictionary<string, object> dic, bool removerKey, PropertyInfo[] propertyInfo, string[] ignoreFields = null) |
| | | public static string ValidateDicInEntity(this Type typeinfo, Dictionary<string, object> dic, bool removerKey, PropertyInfo[] propertyInfo, string[]? ignoreFields = null) |
| | | { |
| | | if (dic == null || dic.Count == 0) { return "åæ°æ æ"; } |
| | | |
| | |
| | | |
| | | foreach (PropertyInfo property in propertyInfo) |
| | | { |
| | | SugarColumn sugarColumn = property.GetCustomAttribute<SugarColumn>(); |
| | | SugarColumn? sugarColumn = property.GetCustomAttribute<SugarColumn>(); |
| | | if (sugarColumn == null) |
| | | { |
| | | Navigate? navigate = property.GetCustomAttribute<Navigate>(); |
| | | if(navigate != null) |
| | | { |
| | | continue; |
| | | } |
| | | return "请é
ç½®SugarColumn屿§"; |
| | | } |
| | | |
| | | //忽ç¥ä¸ä¸»é®çåæ®µä¸åéªè¯ |
| | | if (property.Name == keyName.FirstLetterToUpper() || (ignoreFields != null && ignoreFields.Contains(property.Name)) || sugarColumn.IsOnlyIgnoreInsert || sugarColumn.IsOnlyIgnoreUpdate || sugarColumn.IsIgnore) |
| | | continue; |
| | | |
| | | //ä¸å¨ç¼è¾ä¸çåï¼æ¯å¦ä¹è¦å¿
å¡« |
| | | if (!dic.ContainsKey(property.Name.FirstLetterToLower())) |
| | | if (!dic.ContainsKey(property.Name.FirstLetterToLower()) /*&& !dic.ContainsKey(property.Name.FirstLetterToUpper())*/) |
| | | { |
| | | if (!sugarColumn.IsNullable) |
| | | { |
| | |
| | | { |
| | | foreach (PropertyInfo property in properties) |
| | | { |
| | | SugarColumn sugarColumn = property.GetCustomAttribute<SugarColumn>(); |
| | | if (sugarColumn.IsPrimaryKey) |
| | | return property.Name; |
| | | SugarColumn? sugarColumn = property.GetCustomAttribute<SugarColumn>(); |
| | | if (sugarColumn != null) |
| | | { |
| | | if (sugarColumn.IsPrimaryKey) |
| | | return property.Name; |
| | | } |
| | | } |
| | | return null; |
| | | } |