コード例 #1
0
 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);
     });
 }
コード例 #3
0
 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);
            });
        }
コード例 #6
0
        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);
            });
        }
コード例 #7
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);
            });
        }
コード例 #8
0
        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();
        }