Ejemplo n.º 1
0
        public SuggestionsProxy(IProvideSuggestions suggestionProvider)
        {
            _suggestionProvider = suggestionProvider ?? throw new ArgumentNullException(nameof(suggestionProvider));

            MaxFailures   = 5;
            MinTermLength = 3;

            _cache.NodeRemoved += CacheNodeRemoved;
        }
 private object ServiceLocator(Type type, IProvideSuggestions suggestor)
 {
     if (type == typeof(IValueConverter))
     {
         return(NoExceptionsConverter.Instance);
     }
     if (type == typeof(IFormatProvider))
     {
         return(CultureInfo.InvariantCulture);
     }
     if (type == typeof(IProvideSuggestions))
     {
         return(suggestor);
     }
     throw new NotSupportedException($"Cannot lookup {type.Name}");
 }
Ejemplo n.º 3
0
 public NZazuAutocompleteField(FieldDefinition definition, Func <Type, object> serviceLocatorFunc)
     : base(definition, serviceLocatorFunc)
 {
     _suggester     = (IProvideSuggestions)serviceLocatorFunc(typeof(IProvideSuggestions));
     DataConnection = Definition.Settings.Get("dataconnection") ?? string.Empty;
 }