public bool FinishBuildFromType(ITypeDescriptorFactory factory) { var props = _type !.GetProperties(BindingFlags.Instance | BindingFlags.Public); #if DEBUG CheckObjectTypeIsGoodDto(_type); #endif foreach (var propertyInfo in props) { if (propertyInfo.GetIndexParameters().Length != 0) { continue; } if (ShouldNotBeStored(propertyInfo)) { continue; } var descriptor = factory.Create(propertyInfo.PropertyType); if (descriptor != null) { _fields.Add(new KeyValuePair <string, ITypeDescriptor>(GetPersistentName(propertyInfo), descriptor)); } } _fields.Sort(Comparer <KeyValuePair <string, ITypeDescriptor> > .Create((l, r) => string.Compare(l.Key, r.Key, StringComparison.InvariantCulture))); return(true); }