Exemplo n.º 1
0
        private T AddRequestBinder <T>(Func <RequestBinderContext, Task> bind,
                                       Func <RequestBinderContext, bool> configAppliesTo,
                                       Func <RequestBinderContext, bool> instanceAppliesTo)
            where T : TestRequestBinder, new()
        {
            Configuration.RequestBinders.Append <T>(configAppliesTo);
            var binder = new T
            {
                AppliesToFunc = instanceAppliesTo,
                BindFunc      = bind
            };

            RequestBinders.Add(binder);
            return(binder);
        }
Exemplo n.º 2
0
        public override void Configure(Funq.Container container)
        {
            RequestBinders.Clear();

            JsConfig.EmitCamelCaseNames = true;
            JsConfig.IncludeNullValues  = true;
            JsConfig.DateHandler        = JsonDateHandler.ISO8601;

            Plugins.Add(new ValidationFeature());

            // Add custom request filter
            RequestFilters.Add(GetRequestProcessor.DeserializeJsonFromGet);

            container.Adapter = new AutofacContainerAdapter(containerProvider);
            container.RegisterValidators(typeof(GetTagRequestValidator).Assembly);
        }