Пример #1
0
        private ObjectGiver CreateObjectGiver(HttpContext context)
        {
            // ToDo - merge this with the main request controller setup
            ObjectGiverAndRegistrar giverAndRegistrar = new ObjectGiverAndRegistrar();
            HttpRequest             request           = context.Request;

            giverAndRegistrar.AddTypedObject(typeof(HttpRequest), request);
            giverAndRegistrar.AddTypedObject(typeof(HttpContext), context);
            giverAndRegistrar.AddTypedObject(typeof(ObjectGiver), giverAndRegistrar);

            // Add functionality to object giver to handle this?
            giverAndRegistrar.AddTypedObject(typeof(IRequest), new AggregatedRequest(new NameValueCollectionRequest(request.Form), new NameValueCollectionRequest(request.QueryString)));

            giverAndRegistrar.SetImplementationType(typeof(IPathMapper), typeof(HttpPathMapper));

            giverAndRegistrar.SetDependencyImplementationForType(typeof(PathMappingMultiTransformer), typeof(IMultiTransformer), typeof(HtmlAwareMultiTransformer));

            IConfigurationGetter configurationGetter = (IConfigurationGetter)giverAndRegistrar.GiveObjectByType(typeof(IConfigurationGetter));

            if (configurationGetter == null)
            {
                throw new CruiseControlException("Unable to instantiate configuration getter");
            }

            return(giverAndRegistrar);
        }
Пример #2
0
        private ObjectGiver CreateObjectGiver(HttpContext context)
        {
            // ToDo - merge this with the main request controller setup
            ObjectGiverAndRegistrar giverAndRegistrar = new ObjectGiverAndRegistrar();
            HttpRequest request = context.Request;
            giverAndRegistrar.AddTypedObject(typeof(HttpRequest), request);
            giverAndRegistrar.AddTypedObject(typeof(HttpContext), context);
            giverAndRegistrar.AddTypedObject(typeof(ObjectGiver), giverAndRegistrar);

            // Add functionality to object giver to handle this?
            giverAndRegistrar.AddTypedObject(typeof(IRequest), new AggregatedRequest(new NameValueCollectionRequest(request.Form), new NameValueCollectionRequest(request.QueryString)));

            giverAndRegistrar.SetImplementationType(typeof(IPathMapper), typeof(HttpPathMapper));

            giverAndRegistrar.SetDependencyImplementationForType(typeof(PathMappingMultiTransformer), typeof(IMultiTransformer), typeof (HtmlAwareMultiTransformer));

            IConfigurationGetter configurationGetter = (IConfigurationGetter) giverAndRegistrar.GiveObjectByType(typeof(IConfigurationGetter));
            if (configurationGetter == null)
            {
                throw new CruiseControlException("Unable to instantiate configuration getter");
            }

            return giverAndRegistrar;
        }