Example #1
0
 public ValueConverter Build(IValueConverterRegistry registry, Type type)
 {
     return x => {
     if (x.Value.ToString().Contains(x.TargetName)) return true;
     return ValueConverterRegistry.BasicConvert(typeof(bool), x.Value);
       };
 }
Example #2
0
 public ObjectResolver(IModelBinder[] binders, IValueConverterRegistry converters,
     ITypeDescriptorRegistry registry)
 {
     _binders.AddRange(binders);
     var defaultBinder = new StandardModelBinder(converters, registry);
     _binders.Add(defaultBinder);
 }
 public void SetUp()
 {
     using (var runtime = FubuRuntime.Basic())
     {
         registry = runtime.Get<BindingRegistry>();
     }
 }
Example #4
0
        public void SetUp()
        {
            var container = new Container();

            FubuApplication.For(new FubuRegistry()).StructureMap(container).Bootstrap();
            registry = container.GetInstance <BindingRegistry>();
        }
Example #5
0
 public void SetUp()
 {
     using (var runtime = FubuRuntime.Basic())
     {
         registry = runtime.Get <BindingRegistry>();
     }
 }
        public PropertyBinderCache(IEnumerable<IPropertyBinder> binders, IValueConverterRegistry converters)
        {
            _binders.AddRange(binders);
            _binders.Add(new ConversionPropertyBinder(converters));
            // TODO -- add the hierarchical / child binding

            _cache.OnMissing = prop => _binders.FirstOrDefault(x => x.Matches(prop));
        }
Example #7
0
        public ValueConverter Build(IValueConverterRegistry registry, PropertyInfo property)
        {
            var converter = TypeDescriptor.GetConverter(typeof(bool));

            return x =>
                   x.PropertyValue.ToString().Contains(x.Property.Name)
                   || (bool) converter.ConvertFrom(x.PropertyValue);
        }
Example #8
0
        public ValueConverter Build(IValueConverterRegistry registry, PropertyInfo property)
        {
            var propertyType = property.PropertyType;

            var strategy = _library.StrategyFor(propertyType);

            return(new BasicValueConverter(strategy, propertyType));
        }
Example #9
0
        public PropertyBinderCache(IEnumerable <IPropertyBinder> binders, IValueConverterRegistry converters, ICollectionTypeProvider collectionTypeProvider)
        {
            _binders.AddRange(binders);
            _binders.Add(new ConversionPropertyBinder(converters));
            _binders.Add(new CollectionPropertyBinder(collectionTypeProvider));
            _binders.Add(new NestedObjectPropertyBinder());

            _cache.OnMissing = prop => _binders.FirstOrDefault(x => x.Matches(prop));
        }
Example #10
0
        public PropertyBinderCache(IEnumerable<IPropertyBinder> binders, IValueConverterRegistry converters, ICollectionTypeProvider collectionTypeProvider)
        {
            _binders.AddRange(binders);
            _binders.Add(new ConversionPropertyBinder(converters));
            _binders.Add(new CollectionPropertyBinder(collectionTypeProvider));
            _binders.Add(new NestedObjectPropertyBinder());

            _cache.OnMissing = prop => _binders.FirstOrDefault(x => x.Matches(prop));
        }
        public ValueConverter Build(IValueConverterRegistry registry, PropertyInfo property)
        {
            var entityType = property.PropertyType;

            return(request =>
            {
                var id = request.ValueAs <Guid?>();
                return id.HasValue ? request.Service <IRepository>().Find(entityType, id.Value) : null;
            });
        }
        public ValueConverter Build(IValueConverterRegistry registry, PropertyInfo property)
        {
            var entityType = property.PropertyType;

            return request =>
            {
                var id = request.ValueAs<Guid?>();
                return id.HasValue ? request.Service<IRepository>().Find(entityType, id.Value) : null;
            };
        }
Example #13
0
        public ValueConverter Build(IValueConverterRegistry registry, PropertyInfo property)
        {
            return rawValue =>
            {
                var strVal = rawValue.Value as String;

                return strVal.IsNotEmpty()
                           ? getConnectionString(strVal)
                           : strVal;
            };
        }
        public ValueConverter Build(IValueConverterRegistry registry, PropertyInfo property)
        {
            return(rawValue =>
            {
                var strVal = rawValue.PropertyValue as String;

                return strVal.IsNotEmpty()
                                  ? Environment.ExpandEnvironmentVariables(strVal)
                                  : strVal;
            });
        }
Example #15
0
        public ValueConverter Build(IValueConverterRegistry registry, PropertyInfo property)
        {
            return(rawValue =>
            {
                var strVal = rawValue.PropertyValue as String;

                return strVal.IsNotEmpty()
                           ? getConnectionString(strVal)
                           : strVal;
            });
        }
        public ValueConverter Build(IValueConverterRegistry registry, PropertyInfo property)
        {
            return rawValue =>
                   {
                       var strVal = rawValue.PropertyValue as String;

                       return strVal.IsNotEmpty()
                                  ? Environment.ExpandEnvironmentVariables(strVal)
                                  : strVal;
                   };
        }
        public ValueConverter Build(IValueConverterRegistry registry, PropertyInfo property)
        {
            return(rawValue =>
            {
                var strVal = rawValue.PropertyValue as String;

                return strVal.IsNotEmpty()
                           ? strVal.ToPhysicalPath()
                           : strVal;
            });
        }
Example #18
0
        public ValueConverter Build(IValueConverterRegistry registry, PropertyInfo property)
        {
            return rawValue =>
            {
                var strVal = rawValue.PropertyValue as String;

                return strVal.IsNotEmpty()
                           ? strVal.MapPath()
                           : strVal;
            };
        }
Example #19
0
        public ValueConverter Build(IValueConverterRegistry registry, Type type)
        {
            Type innerType = type.GetGenericArguments()[0];
              ValueConverter inner = registry[innerType];

              return x =>
              {
            if (x.Value == null || (x.Value is string && (string)x.Value == string.Empty)) return null;

            return inner(x);
              };
        }
Example #20
0
        public ValueConverter Build(IValueConverterRegistry registry, PropertyInfo property)
        {
            var converter = TypeDescriptor.GetConverter(typeof(bool));

            return x =>
            {
                if (x.PropertyValue is bool) return x.PropertyValue;

                return x.PropertyValue.ToString().Contains(x.Property.Name)
                || x.PropertyValue.ToString().EqualsIgnoreCase(Checkbox_On)
                || (bool) converter.ConvertFrom(x.PropertyValue);
            };
        }
Example #21
0
        public ValueConverter Build(IValueConverterRegistry registry, PropertyInfo property)
        {
            var converter = TypeDescriptor.GetConverter(typeof(bool));

            return(x =>
            {
                if (x.PropertyValue is bool)
                {
                    return x.PropertyValue;
                }

                return x.PropertyValue.ToString().Contains(x.Property.Name) ||
                x.PropertyValue.ToString().EqualsIgnoreCase(Checkbox_On) ||
                (bool)converter.ConvertFrom(x.PropertyValue);
            });
        }
Example #22
0
 public ValueConverter Build(IValueConverterRegistry registry, PropertyInfo property)
 {
     return(this);
 }
 public void SetUp()
 {
     registry = StructureMapContainerFacility.GetBasicFubuContainer().GetInstance<IValueConverterRegistry>();
 }
 public ConversionPropertyBinder(IValueConverterRegistry converters)
 {
     _cache.OnMissing = prop => converters.FindConverter(prop);
 }
 public ValueConverter Build(IValueConverterRegistry registry, PropertyInfo property)
 {
     return(context => context.PropertyValue);
 }
 public void SetUp()
 {
     registry = StructureMapContainerFacility.GetBasicFubuContainer().GetInstance <IValueConverterRegistry>();
 }
Example #27
0
 public ValueConverter Build(IValueConverterRegistry registry, PropertyInfo property)
 {
     return(_builder(registry, property));
 }
 public ValueConverter Build(IValueConverterRegistry registry, PropertyInfo prop)
 {
     return(null);
 }
 public ValueConverter Build(IValueConverterRegistry registry, PropertyInfo property)
 {
     return(typeof(PassthroughConverter <>).CloseAndBuildAs <ValueConverter>(property.PropertyType));
 }
 public ValueConverter Build(IValueConverterRegistry registry, PropertyInfo property)
 {
     return typeof (PassthroughConverter<>).CloseAndBuildAs<ValueConverter>(property.PropertyType);
 }
Example #31
0
 public ValueConverter Build(IValueConverterRegistry registry, PropertyInfo property)
 {
     return x =>
            x.Value.ToString().Contains(x.Property.Name)
            || (bool) ValueConverterRegistry.BasicConvert(typeof (bool), x.Value);
 }
Example #32
0
 public ValueConverter Build(IValueConverterRegistry registry, Type type)
 {
     return x => Enum.Parse(type, x.Value.ToString());
 }
Example #33
0
 public ValueConverter Build(IValueConverterRegistry registry, Type type)
 {
     return x => x.Value == null ? Guid.Empty : new Guid(x.Value.ToString());
 }
        public ValueConverter Build(IValueConverterRegistry registry, PropertyInfo property)
        {
            var propertyType = property.PropertyType;

            return(_converters[propertyType]);
        }
 public ConversionPropertyBinder(IValueConverterRegistry converters)
 {
     _cache.OnMissing = prop => converters.FindConverter(prop);
 }
Example #36
0
 public ValueConverter Build(IValueConverterRegistry registry, PropertyInfo property)
 {
     return _builder(registry, property);
 }
Example #37
0
 public StandardModelBinder(IValueConverterRegistry converters, ITypeDescriptorRegistry typeRegistry)
 {
     _converters = converters;
     _typeRegistry = typeRegistry;
     NamingStrategy = DefaultNamingStrategy;
 }
 public ConversionPropertyBinder(IValueConverterRegistry converters)
 {
     _converters = converters;
 }
        public ValueConverter Build(IValueConverterRegistry registry, PropertyInfo property)
        {
            var propertyType = property.PropertyType;

            return(GetValueConverter(propertyType));
        }
 public ValueConverter Build(IValueConverterRegistry registry, PropertyInfo property)
 {
     return this;
 }
 public void SetUp()
 {
     var container = new Container();
     FubuApplication.For(new FubuRegistry()).StructureMap(container).Bootstrap();
     registry = container.GetInstance<BindingRegistry>();
 }
 public ValueConverter Build(IValueConverterRegistry registry, PropertyInfo property)
 {
     return context => context.PropertyValue;
 }
 public ValueConverter Build(IValueConverterRegistry registry, PropertyInfo prop)
 {
     throw new NotImplementedException();
 }
 public ValueConverter Build(IValueConverterRegistry registry, PropertyInfo prop)
 {
     return null;
 }
Example #45
0
 protected virtual void FillValueConverters(IValueConverterRegistry registry)
 {
     registry.AddOrOverwrite("CommandParameter", new CommandParameterValueConverter());
 }
Example #46
0
 public ValueConverter Build(IValueConverterRegistry registry, PropertyInfo prop)
 {
     throw new NotImplementedException();
 }
Example #47
0
 public ValueConverter Build(IValueConverterRegistry registry, Type type)
 {
     return _builder(registry, type);
 }