コード例 #1
0
ファイル: Filler.cs プロジェクト: chrisjowen/FillMe
        private IEnumerable <PropertyInfo> GetOrderedProperties(Type type, IMappingSet mappingSet)
        {
            var mappedProperties   = mappingSet.Items.OrderBy(i => i.OrderNum).Select(m => m.Property);
            var unmappedProperties = GetPropertiesFor(type).Where(p => !mappedProperties.Contains(p));

            return(mappedProperties.Concat(unmappedProperties));
        }
コード例 #2
0
ファイル: Filler.cs プロジェクト: chrisjowen/FillMe
        private void PopulateProperty <T>(IMappingSet mappingSet, PropertyInfo property, object rootObject, T objectToFill)
        {
            var mappingItem = mappingSet.GetForProperty(property);

            if (property.PropertyType.IsAStandardType())
            {
                if (mappingItem != null && mappingItem.Generator != null && !mappingItem.ShouldIgnore)
                {
                    property.SetValue(objectToFill, mappingItem.Generator.Generate(new GenerationContext(rootObject, objectToFill)), null);
                }
            }
            else
            {
                PopulateObject(mappingItem, property, objectToFill, rootObject);
            }
        }