Exemple #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);
       };
 }
Exemple #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>();
     }
 }
Exemple #4
0
        public void SetUp()
        {
            var container = new Container();

            FubuApplication.For(new FubuRegistry()).StructureMap(container).Bootstrap();
            registry = container.GetInstance <BindingRegistry>();
        }
Exemple #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));
        }
Exemple #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);
        }
Exemple #8
0
        public ValueConverter Build(IValueConverterRegistry registry, PropertyInfo property)
        {
            var propertyType = property.PropertyType;

            var strategy = _library.StrategyFor(propertyType);

            return(new BasicValueConverter(strategy, propertyType));
        }
Exemple #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));
        }
Exemple #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;
            };
        }
Exemple #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;
            });
        }
Exemple #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;
            });
        }
        public ValueConverter Build(IValueConverterRegistry registry, PropertyInfo property)
        {
            return rawValue =>
            {
                var strVal = rawValue.PropertyValue as String;

                return strVal.IsNotEmpty()
                           ? strVal.MapPath()
                           : strVal;
            };
        }
Exemple #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);
              };
        }
        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);
            };
        }
Exemple #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);
            });
        }
Exemple #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>();
 }
Exemple #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);
 }
Exemple #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);
 }
Exemple #32
0
 public ValueConverter Build(IValueConverterRegistry registry, Type type)
 {
     return x => Enum.Parse(type, x.Value.ToString());
 }
Exemple #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);
 }
 public ValueConverter Build(IValueConverterRegistry registry, PropertyInfo property)
 {
     return _builder(registry, property);
 }
Exemple #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;
 }
Exemple #45
0
 protected virtual void FillValueConverters(IValueConverterRegistry registry)
 {
     registry.AddOrOverwrite("CommandParameter", new CommandParameterValueConverter());
 }
 public ValueConverter Build(IValueConverterRegistry registry, PropertyInfo prop)
 {
     throw new NotImplementedException();
 }
Exemple #47
0
 public ValueConverter Build(IValueConverterRegistry registry, Type type)
 {
     return _builder(registry, type);
 }