Exemplo n.º 1
0
 private void populate(Type type, IBindingContext context)
 {
     _typeCache.ForEachProperty(type, prop =>
     {
         _propertyBinders.BinderFor(prop).Bind(prop, context);
     });
 }
Exemplo n.º 2
0
        public void Bind(Type type, object instance, IBindingContext context)
        {
            var request = context.Service <IFubuRequest>();

            _types.ForEachProperty(type, prop =>
            {
                var value = request.Get(prop.PropertyType);
                prop.SetValue(instance, value, null);
            });
        }
Exemplo n.º 3
0
        private ClassFieldValidationRules findRules(Type type)
        {
            var classRules = new ClassFieldValidationRules();

            _typeDescriptors.ForEachProperty(type, property =>
            {
                var accessor = new SingleProperty(property);
                var rules    = _sources.SelectMany(x => x.RulesFor(property)).Distinct();
                classRules.AddRules(accessor, rules);
            });

            return(classRules);
        }
Exemplo n.º 4
0
        public void FillRules(ActionCall call)
        {
            var input = call.InputType();

            if (input == null)
            {
                return;
            }

            _properties.ForEachProperty(input, property =>
            {
                var accessor = new SingleProperty(property);
                var rules    = _graph
                               .Query()
                               .RulesFor(accessor)
                               .Where(rule => _remotes.IsRemote(rule));

                rules.Each(rule => _remoteGraph.RegisterRule(accessor, rule));
            });
        }
Exemplo n.º 5
0
        private void write(object directive, Type type)
        {
            _types.ForEachProperty(type, prop =>
            {
                var child = prop.GetValue(directive, null);

                if (prop.PropertyType.IsSimple())
                {
                    var stringValue = child == null ? string.Empty : child.ToString();
                    var name        = "{0}{1}".ToFormat(_prefix, prop.Name);

                    _writer.WriteProperty(name, stringValue);
                }
                else
                {
                    if (child != null)
                    {
                        setPrefix(x => x.Push(prop.Name));
                        write(child, child.GetType());
                        setPrefix(x => x.Pop());
                    }
                }
            });
        }
Exemplo n.º 6
0
 private void populate(Type type, IBindingContext context)
 {
     _typeCache.ForEachProperty(type, prop => PopulateProperty(type, prop, context));
 }