Esempio n. 1
0
		private bool HandleComplexField(object item, DataReaderField field, object value)
		{
			string propertyName = null;

			for (var level = 0; level <= field.NestedLevels; level++)
			{
				if (string.IsNullOrEmpty(propertyName))
					propertyName = field.GetNestedName(level);
				else
					propertyName += "_" + field.GetNestedName(level);

				PropertyInfo property = null;
				var properties = ReflectionHelper.GetProperties(item.GetType());
				if (properties.TryGetValue(propertyName, out property))
				{
					if (level == field.NestedLevels)
					{
						SetPropertyValue(field, property, item, value);
						return true;
					}
					else
					{
						item = GetOrCreateInstance(item, property);
						if (item == null)
							return false;
						propertyName = null;	
					}
				}
			}

			return false;
		}
Esempio n. 2
0
        private bool method_0(object object_0, DataReaderField dataReaderField_0, object object_1)
        {
            string text = null;
            int    num  = 0;

            while (true)
            {
                if (num > dataReaderField_0.NestedLevels)
                {
                    return(false);
                }
                text = ((!string.IsNullOrEmpty(text)) ? (text + "_" + dataReaderField_0.GetNestedName(num)) : dataReaderField_0.GetNestedName(num));
                PropertyInfo value = null;
                Dictionary <string, PropertyInfo> properties = ReflectionHelper.GetProperties(object_0.GetType());
                if (properties.TryGetValue(text, out value))
                {
                    if (num == dataReaderField_0.NestedLevels)
                    {
                        method_2(dataReaderField_0, value, object_0, object_1);
                        return(true);
                    }
                    object_0 = method_1(object_0, value);
                    if (object_0 == null)
                    {
                        break;
                    }
                    text = null;
                }
                num++;
            }
            return(false);
        }
Esempio n. 3
0
        private bool HandleComplexField(object item, DataReaderField field, object value)
        {
            string propertyName = null;

            for (var level = 0; level <= field.NestedLevels; level++)
            {
                if (string.IsNullOrEmpty(propertyName))
                {
                    propertyName = field.GetNestedName(level);
                }
                else
                {
                    propertyName += "_" + field.GetNestedName(level);
                }

                PropertyInfo property   = null;
                var          properties = ReflectionHelper.GetProperties(item.GetType());
                if (properties.TryGetValue(propertyName, out property))
                {
                    if (level == field.NestedLevels)
                    {
                        SetPropertyValue(field, property, item, value);
                        return(true);
                    }
                    else
                    {
                        item = GetOrCreateInstance(item, property);
                        if (item == null)
                        {
                            return(false);
                        }
                        propertyName = null;
                    }
                }
            }

            return(false);
        }