public void Bind(PropertyInfo property, IBindingContext context)
 {
     context.ForProperty(property, () =>
     {
         ValueConverter converter = _converters.FindConverter(property);
         object value = converter(context);
         property.SetValue(context.Object, value, null);
     });
 }
예제 #2
0
 public static void PopulatePropertyWithBinder(PropertyInfo property, IBindingContext context,
                                               IPropertyBinder propertyBinder)
 {
     context.Logger.Chose(property, propertyBinder);
     context.ForProperty(property, propertyContext =>
     {
         propertyBinder.Bind(property, context);
     });
 }
 public static void PopulatePropertyWithBinder(PropertyInfo property, IBindingContext context,
                                               IPropertyBinder propertyBinder)
 {
     context.Logger.Chose(property, propertyBinder);
     context.ForProperty(property, propertyContext =>
     {
         propertyBinder.Bind(property, context);
     });
 }
예제 #4
0
        // TODO -- need an integrated test with Connection String providers
        public void Bind(PropertyInfo property, IBindingContext context)
        {
            context.ForProperty(property, () =>
            {
                ValueConverter converter = _cache[property];

                var value = converter(context);

                property.SetValue(context.Object, value, null);
            });
        }
예제 #5
0
        // TODO -- need an integrated test with Connection String providers
        public void Bind(PropertyInfo property, IBindingContext context)
        {
            context.ForProperty(property, () =>
            {
                ValueConverter converter = _cache[property];

                var value = converter(context);

                property.SetValue(context.Object, value, null);
            });
        }
        public void Bind(PropertyInfo property, IBindingContext context)
        {
            context.ForProperty(property, x =>
            {
                var converter = _cache[property];

                context.Logger.ChoseValueConverter(property, converter);

                var value = converter.Convert(x);

                x.SetPropertyValue(value);
            });
        }
        // TODO -- need an integrated test with Connection String providers
        public void Bind(PropertyInfo property, IBindingContext context)
        {
            context.ForProperty(property, x =>
            {
                var converter = _cache[property];

                context.Logger.ChoseValueConverter(property, converter);

                var value = converter.Convert(x);

                property.SetValue(x.Object, value, null);
            });
        }
        public void Bind(PropertyInfo property, IBindingContext context)
        {
            context.ForProperty(property, x =>
            {
                var converter = _cache[property];

                context.Logger.ChoseValueConverter(property, converter);

                var value = converter.Convert(x);

                x.SetPropertyValue(value);
            });
        }
예제 #9
0
        // TODO -- need an integrated test with Connection String providers
        public void Bind(PropertyInfo property, IBindingContext context)
        {
            context.ForProperty(property, x =>
            {
                var converter = _cache[property];

                context.Logger.ChoseValueConverter(property, converter);

                var value = converter.Convert(x);

                property.SetValue(x.Object, value, null);
            });
        }
예제 #10
0
        public void Bind(PropertyInfo property, IBindingContext context)
        {
            context.ForProperty(property, x =>
            {
                var data = x.RawValueFromRequest != null ? x.RawValueFromRequest.RawValue : null;
                if (data != null)
                {
                    var converter = _cache[property];

                    context.Logger.Chose(property, converter);

                    var value = converter.Convert(x);

                    x.SetPropertyValue(value);
                }
            });
        }
예제 #11
0
        public void Bind(PropertyInfo property, IBindingContext context)
        {
            context.ForProperty(property, x =>
            {
                var data = x.RawValueFromRequest != null ? x.RawValueFromRequest.RawValue : null;
                if (data != null)
                {
                    var converter = _cache[property];

                    context.Logger.Chose(property, converter);

                    var value = converter.Convert(x);

                    x.SetPropertyValue(value);
                }
            });
        }
예제 #12
0
        public void prefix_with_returns_a_working_binding_context()
        {
            request["AddressAddress1"] = "479 SW 85th St";
            var property = ReflectionHelper.GetProperty <Address>(x => x.Address1);

            bool wasCalled = false;

            context.StartObject(new Address());
            IBindingContext prefixed = context.PrefixWith("Address");

            prefixed.ForProperty(property, x =>
            {
                x.PropertyValue.ShouldEqual(request["AddressAddress1"]);


                wasCalled = true;
            });

            context.Problems.Any().ShouldBeFalse();

            wasCalled.ShouldBeTrue();
        }