<commit_before>﻿namespace Construktion.Blueprints
{
    using System;
    using System.Linq;
    using System.Reflection;

    public class ClassBlueprint : Blueprint
    {
        public bool Matches(ConstruktionContext context)
        {
            return context.RequestType.GetTypeInfo().IsClass;
        }

        public object Build(ConstruktionContext context, ConstruktionPipeline pipeline)
        {
            var instance = Activator.CreateInstance(context.RequestType);

            var properties = context.RequestType.GetRuntimeProperties().ToList();
                //look into 
                //.GetProperties(BindingFlags.Public | BindingFlags.Instance);

            foreach (var property in properties)
            {
                var pi = context.RequestType.GetRuntimeProperty(property.Name);

                var result = pipeline.Build(new ConstruktionContext(pi));
                    
                pi.SetValue(instance, result);
            }

            return instance;
        }
    }
}<commit_msg>no need to get the property type again in ClassBuilder<commit_after>﻿namespace Construktion.Blueprints
{
    using System;
    using System.Linq;
    using System.Reflection;

    public class ClassBlueprint : Blueprint
    {
        public bool Matches(ConstruktionContext context)
        {
            return context.RequestType.GetTypeInfo().IsClass && context.RequestType.HasDefaultCtor();
        }

        public object Build(ConstruktionContext context, ConstruktionPipeline pipeline)
        {
            var instance = Activator.CreateInstance(context.RequestType);

            var properties = context.RequestType.GetRuntimeProperties().ToList();
                //.GetProperties(BindingFlags.Public | BindingFlags.Instance);

            foreach (var property in properties)
            {
                var result = pipeline.Build(new ConstruktionContext(property));
                    
                property.SetValue(instance, result);
            }

            return instance;
        }
    }
}
{'fraction_non_alphanumeric': 0.07639902676399027, 'fraction_numerical': 0.0, 'mean_word_length': 2.054977711738484, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '810885', 'n_tokens_mistral': 492, 'n_tokens_neox': 470, 'n_words': 105}