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); }); }
public static void PopulatePropertyWithBinder(PropertyInfo property, IBindingContext context, IPropertyBinder propertyBinder) { context.Logger.Chose(property, propertyBinder); context.ForProperty(property, propertyContext => { propertyBinder.Bind(property, context); }); }
// 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 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); } }); }
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(); }