示例#1
0
        public object GetValue(IObjectReader reader, string propertyName)
        {
            if (reader.Properties != null)
            {
                var property = reader.Properties.FirstOrDefault(x => string.Equals(x, propertyName, PropertyComparer));
                if (property != null)
                {
                    return reader.GetValue(property);
                }
            }
            else
            {
                object obj;
                if (reader.TryGetValue(propertyName, out obj))
                    return obj;
            }

            if (!IsIgnoreNotExistingProperty)
                throw new FieldNotFoundException(propertyName);

            return _propertyNotExisting;
        }