public void ConfigureContainer(ServiceConfigurationContext context)
        {
            var contentApiOptions = new ContentApiOptions
            {
                MultiSiteFilteringEnabled = false
            };

            context.InitializeContentApi(contentApiOptions);
            context.InitializeContentSearchApi(new ContentSearchApiOptions()
            {
                SearchCacheDuration = TimeSpan.Zero
            });

            //context.Services.AddSingleton<IPropertyModelHandler, LowercaseLongStringPropertyModelHandler>();

            DependencyResolver.SetResolver(new StructureMapDependencyResolver(context.StructureMap()));

            GlobalConfiguration.Configure(config =>
            {
                config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.LocalOnly;
                config.Formatters.JsonFormatter.SerializerSettings = new JsonSerializerSettings();
                config.Formatters.XmlFormatter.UseXmlSerializer    = true;
                config.DependencyResolver = new StructureMapResolver(context.StructureMap());
                config.MapHttpAttributeRoutes();
                config.EnableCors();
            });
        }
Esempio n. 2
0
        public void ConfigureContainer(ServiceConfigurationContext context)
        {
            //Implementations for custom interfaces can be registered here.
            context.InitializeContentApi();
            context.InitializeContentSearchApi();


            GlobalConfiguration.Configure(config =>
            {
                config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.LocalOnly;
                config.Formatters.JsonFormatter.SerializerSettings = new JsonSerializerSettings();
                config.Formatters.XmlFormatter.UseXmlSerializer    = true;
                config.DependencyResolver = new StructureMapResolver(context.StructureMap());
                //Other config settings may already be here, but ensure these are added:
                config.MapHttpAttributeRoutes();
                config.EnableCors();
            });

            context.ConfigurationComplete += (o, e) =>
            {
                //Register custom implementations that should be used in favour of the default implementations
                context.Services.AddTransient <IContentRenderer, ErrorHandlingContentRenderer>()
                .AddTransient <ContentAreaRenderer, AlloyContentAreaRenderer>();
            };
        }
Esempio n. 3
0
        public void ConfigureContainer(ServiceConfigurationContext context)
        {
            var services = context.Services;

            services.AddSingleton <IClickTrackingService, ClickTrackingService>();

            services.AddSingleton <ICurrentMarket, CurrentMarket>();

            //Register for auto injection of edit mode check, should be default life cycle (per request to service locator)
            services.AddTransient <IsInEditModeAccessor>(locator => () => PageEditing.PageIsInEditMode);

            services.Intercept <IUpdateCurrentLanguage>(
                (locator, defaultImplementation) =>
                new LanguageService(
                    locator.GetInstance <ICurrentMarket>(),
                    locator.GetInstance <CookieService>(),
                    defaultImplementation));

            services.AddTransient <IModelBinderProvider, ModelBinderProvider>();
            services.AddHttpContextOrThreadScoped <SiteContext, CustomCurrencySiteContext>();
            services.AddTransient <HttpContextBase>(locator => HttpContext.Current.ContextBaseOrNull());

            var contentApiOptions = new ContentApiOptions
            {
                MultiSiteFilteringEnabled = false
            };

            context.InitializeContentApi(contentApiOptions);
            context.InitializeContentSearchApi(new ContentSearchApiOptions()
            {
                SearchCacheDuration = TimeSpan.Zero
            });

            DependencyResolver.SetResolver(new StructureMapDependencyResolver(context.StructureMap()));

            GlobalConfiguration.Configure(config =>
            {
                config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.LocalOnly;
                config.Formatters.JsonFormatter.SerializerSettings = new JsonSerializerSettings();
                config.Formatters.XmlFormatter.UseXmlSerializer    = true;
                config.DependencyResolver = new StructureMapResolver(context.StructureMap());
                config.MapHttpAttributeRoutes();
                config.EnableCors();
            });


#if IRI_CHARACTERS_IN_URL_FEATURE
            EnableIriCharactersInUrls(context);
#endif
        }
Esempio n. 4
0
        public void ConfigureContainer(ServiceConfigurationContext context)
        {
            var contentApiOptions = new ContentApiOptions
            {
                MultiSiteFilteringEnabled = false
            };

            context.InitializeContentApi(contentApiOptions);

            // Register the extended content model mapper to be able to provide custom models from content api
            context.Services.Intercept <IContentModelMapper>((locator, defaultModelMapper) =>
                                                             new ExtendedContentModelMapper(
                                                                 locator.GetInstance <IUrlResolver>(),
                                                                 defaultModelMapper,
                                                                 locator.GetInstance <ServiceAccessor <HttpContextBase> >(),
                                                                 locator.GetInstance <IContentVersionRepository>()
                                                                 )
                                                             );

            context.InitializeContentSearchApi(new ContentSearchApiOptions()
            {
                SearchCacheDuration = TimeSpan.Zero
            });

            DependencyResolver.SetResolver(new StructureMapDependencyResolver(context.StructureMap()));

            GlobalConfiguration.Configure(config =>
            {
                config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.LocalOnly;
                config.Formatters.JsonFormatter.SerializerSettings = new JsonSerializerSettings();
                config.Formatters.XmlFormatter.UseXmlSerializer    = true;
                config.DependencyResolver = new StructureMapResolver(context.StructureMap());
                config.MapHttpAttributeRoutes();
                config.EnableCors();
            });
            context.Services.AddTransient <IPropertyModelHandler, BuyTicketBlockPropertyModelHandler>();
        }