huangxiaoqiang
2025-03-04 1b6ccb64675e5262a2f7135697edc7466ffc14bf
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/ObjectExtension.cs
@@ -23,18 +23,15 @@
        {
            T model = Activator.CreateInstance<T>();
            PropertyInfo[] propertyInfos = typeof(T).GetProperties(BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.Instance);
            Dictionary<string, object> upperDic = dic.ToDictionary(x => x.Key.ToUpper(), y => y.Value);
            foreach (var property in propertyInfos)
            {
                object value = null;
                if (!dic.TryGetValue(property.Name, out value))
                if (!upperDic.TryGetValue(property.Name.ToUpper(), out value))
                {
                    if (!dic.TryGetValue(property.Name.FirstLetterToUpper(), out value))
                    {
                        if (!dic.TryGetValue(property.Name.FirstLetterToLower(), out value))
                        {
                            continue;
                        }
                    }
                    continue;
                };
                property.SetValue(model, value?.ToString().ChangeType(property.PropertyType));
            }