private IDictionary <string, BucketItem> CreateItems(Type target) { PropertyInfo[] infos = target.GetProperties(); IDictionary <string, BucketItem> list = new Dictionary <string, BucketItem>(); foreach (PropertyInfo info in infos) { if (info.CanRead && info.CanWrite) { string fieldName = string.Empty; object[] arg = info.GetCustomAttributes(typeof(IgnoreAttribute), false); if (arg.Length == 0) { const bool visible = true; arg = info.GetCustomAttributes(typeof(NameAttribute), false); if (arg.Length > 0) { var fieldNameAttr = arg[0] as NameAttribute; if (fieldNameAttr != null) { fieldName = fieldNameAttr.Name; } } else { fieldName = info.Name; } arg = info.GetCustomAttributes(typeof(UniqueIdentifierAttribute), true); bool isUnique = arg.Length > 0; // only if not already added. if (!list.ContainsKey(info.Name)) { var newItem = new BucketItem(target, fieldName, info.Name, info.PropertyType, null, isUnique, BinaryOperator.Equal, visible) { Container = this }; list.Add(info.Name, newItem); } } } } return(list); }
private BucketItem ProcessNestedBucket(Bucket bucket) { foreach (string key in bucket.Items.Keys) { BucketItem childItem = bucket.Items[key]; if (childItem.Value != null && !childItem.IsVisited) { childItem.IsVisited = true; return(childItem); } if (childItem.Child != null) { return(ProcessNestedBucket(childItem.Child)); } } return(null); }