Пример #1
0
        public static bool TryGetProperty(this object instance, string propName, bool ignoreCase, out object propValue)
        {
            propValue = null;
            if (instance == null)
            {
                return(false);
            }

            //JArray
            //JObject
            if (instance is JObject jObject)
            {
                var dic            = (IDictionary <string, JToken>)jObject;
                var tryGetProperty = dic.TryGetValue(propName, ignoreCase, out propValue);
                return(tryGetProperty);
            }

            var dic2            = MyModelHelper.GetKeyValueDictionary(instance);
            var tryGetProperty2 = dic2.TryGetValue(propName, ignoreCase, out propValue);

            return(tryGetProperty2);
        }
Пример #2
0
 public void SetProperties(IDictionary <string, object> items, object toBeUpdated, string modelName)
 {
     MyModelHelper.SetPropertiesWithDictionary(items, toBeUpdated, modelName + ".");
 }