コード例 #1
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 <IOrderGroupCalculator, SiteOrderGroupCalculator>();
            services.AddTransient <IOrderFormCalculator, SiteOrderFormCalculator>();
            services.AddTransient <IModelBinderProvider, ModelBinderProvider>();
            services.AddHttpContextOrThreadScoped <SiteContext, CustomCurrencySiteContext>();
            services.AddTransient <HttpContextBase>(locator => HttpContext.Current.ContextBaseOrNull());

            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();
            });
        }
コード例 #2
0
        public static void ConfigureFoundationCms(this ServiceConfigurationContext context)
        {
            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();
            });

            context.Services.Configure <TinyMceConfiguration>(config =>
            {
                config.Default()
                .AddPlugin("media wordcount anchor code textcolor colorpicker")
                .Toolbar("formatselect | epi-personalized-content epi-link anchor numlist bullist indent outdent bold italic underline alignleft aligncenter alignright | image epi-image-editor media code | epi-dnd-processor | removeformat | fullscreen | forecolor backcolor | icons")
                .AddSetting("image_caption", true)
                .AddSetting("image_advtab", true);

                config.Default()
                .AddExternalPlugin("icons", "/ClientResources/Scripts/fontawesomeicons.js")
                .AddSetting("extended_valid_elements", "i[class], span")
                .ContentCss(new[] { "/ClientResources/Styles/fontawesome.min.css",
                                    "https://fonts.googleapis.com/css?family=Roboto:100,100i,300,300i,400,400i,500,500i,700,700i,900,900i",
                                    "/ClientResources/Styles/TinyMCE.css" });
            });
        }
コード例 #3
0
        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();
            });
        }
コード例 #4
0
        public void ConfigureContainer(ServiceConfigurationContext context)
        {
            context.StructureMap().Configure(c => c.For <UniversalSyntax>().Use <UniversalSyntaxEx>());

            // As the GA does only support one IPluginScript at the moment, we
            // override it here.
            context.StructureMap().Configure(c => c.For <IPluginScript>().Use <RequireEnhancedCommercePlugin>());
        }
        public void ConfigureContainer(ServiceConfigurationContext context)
        {
            context.StructureMap().Configure(ConfigureContainer);
            var resolver = new StructureMapDependencyResolver(context.StructureMap());

            DependencyResolver.SetResolver(resolver);
            GlobalConfiguration.Configuration.DependencyResolver = resolver;
        }
 /// <inheritdoc/>
 public void ConfigureContainer(ServiceConfigurationContext context)
 {
     if (!context.StructureMap().GetAllInstances <IContentIndexer>().Any())
     {
         context.StructureMap().Configure(c => c.For <IContentIndexer>().Singleton().Use(ContentIndexer.Instance));
     }
     context.StructureMap().Configure(c => c.For <EventedIndexingSettings>().Singleton().Use(() => EventedIndexingSettings.Instance));
 }
コード例 #7
0
        public void ConfigureContainer(ServiceConfigurationContext context)
        {
            var container = context.StructureMap();

            container.Configure(ConfigureContainer);

            DependencyResolver.SetResolver(new StructureMapDependencyResolver(container));

            GlobalConfiguration.Configuration.Services.Replace(
                typeof(IHttpControllerActivator),
                new StructureMapHttpControllerActivator(context.StructureMap()));
        }
コード例 #8
0
 public void ConfigureContainer(ServiceConfigurationContext context)
 {
     context.StructureMap().Configure(ctx => { ctx.ForConcreteType <ResetPasswordModule>(); });
     context.StructureMap().Configure(ctx => { ctx.ForConcreteType <DpapiDataProtectionProvider>().Configure.Ctor <string>("appName").Is("ResetPasswordApp"); });
     context.StructureMap().Configure(ctx => { ctx.For <IDataProtector>().Use(ct => ct.GetInstance <DpapiDataProtectionProvider>().Create("ResetPassword")); });
     context.StructureMap().Configure(ctx => { ctx.For <IUserTokenProvider <ApplicationUser, string> >().Use <DataProtectorTokenProvider <ApplicationUser> >(); });
     context.StructureMap().Configure(ctx =>
     {
         ctx.ForConcreteType <UserManager <ApplicationUser> >().Configure.
         OnCreation("Adding token provider", (ct, m) => m.UserTokenProvider = ct.GetInstance <DataProtectorTokenProvider <ApplicationUser> >());
     });
 }
コード例 #9
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
        }
コード例 #10
0
        public void ConfigureContainer(ServiceConfigurationContext context)
        {
            DependencyResolver.SetResolver(new WebStructureMapDependencyResolver(context.StructureMap()));

            GlobalConfiguration.Configure(config =>
            {
                config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.LocalOnly;
                config.Formatters.JsonFormatter.SerializerSettings = new JsonSerializerSettings();
                config.Formatters.XmlFormatter.UseXmlSerializer    = false;
                config.DependencyResolver = new StructureMapResolver(context.StructureMap());
                config.MapHttpAttributeRoutes();
                config.Routes.MapHttpRoute("API Default", "api/{controller}/{id}", new { id = RouteParameter.Optional });
            });
        }
コード例 #11
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());

            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();
            });

            // To support an extended range of characters (outside of what has been defined in RFC1738) in URLs, define UNICODE_CHARACTERS_IN_URL symbol - this should be done both in Commerce Manager and Front-end site.
            // More information about this feature: http://world.episerver.com/documentation/developer-guides/CMS/routing/internationalized-resource-identifiers-iris/

            // The code block below will allow general Unicode letter characters.
            // To support more Unicode blocks, update the regular expression for ValidUrlCharacters.
            // For example, to support Thai Unicode block, add \p{IsThai} to it.
            // The supported Unicode blocks can be found here: https://msdn.microsoft.com/en-us/library/20bw873z(v=vs.110).aspx#Anchor_12

#if UNICODE_CHARACTERS_IN_URL
            context.Services.RemoveAll <UrlSegmentOptions>();
            context.Services.AddSingleton <UrlSegmentOptions>(s => new UrlSegmentOptions
            {
                Encode             = true,
                ValidUrlCharacters = @"\p{L}0-9\-_~\.\$"
            });
#endif
        }
        public void ConfigureContainer(ServiceConfigurationContext context)
        {
            var services = context.Services;


            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();
            });
        }
コード例 #13
0
        public void ConfigureContainer(ServiceConfigurationContext context)
        {
            var services = context.Services;

            services.AddSingleton <IRecommendationContext, RecommendationContext>();

            services.AddSingleton <ICurrentMarket, CurrentMarket>();

            services.AddSingleton <ITrackingResponseDataInterceptor, TrackingResponseDataInterceptor>();

            //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());

            services.AddTransient <IVippsService, VippsService>();
            services.AddTransient <IVippsPaymentService, VippsPaymentService>();
            services.AddTransient <IVippsRequestFactory, DefaultVippsRequestFactory>();
            services.AddTransient <IVippsResponseFactory, DefaultVippsResponseFactory>();
            services.AddSingleton <IVippsOrderSynchronizer, DefaultVippsOrderSynchronizer>();
            services.AddSingleton <IVippsOrderProcessor, DefaultVippsOrderProcessor>();
            services.AddSingleton <IVippsPollingService, VippsPollingService>();

            services.AddSingleton <ServiceAccessor <IContentRouteHelper> >(locator => locator.GetInstance <IContentRouteHelper>);

            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();
            });

#if IRI_CHARACTERS_IN_URL_FEATURE
            EnableIriCharactersInUrls(context);
#endif
        }
コード例 #14
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>();
            };
        }
コード例 #15
0
        public void ConfigureContainer(ServiceConfigurationContext context)
        {
            var builder = new FeatureSetBuilder(new StructureMapDependencyContainer(context.StructureMap()));

            builder.Build(ctx => { ctx.AutoDiscoverFeatures = true; })
            .ValidateConfiguration();
        }
        public void ConfigureContainer(ServiceConfigurationContext context)
        {
            DependencyResolver.SetResolver(new StructureMapDependencyResolver(context.StructureMap()));

            context.Services.AddSingleton(typeof(IClient), Client.CreateFromConfig());
            context.Services.UserDefaultService();
        }
コード例 #17
0
        public void ConfigureContainer(ServiceConfigurationContext context)
        {
            context.Services.AddTransient <IContentRenderer, ErrorHandlingContentRenderer>();
            context.Services.AddTransient <ContentAreaRenderer, AlloyContentAreaRenderer>();

            DependencyResolver.SetResolver(new StructureMapDependencyResolver(context.StructureMap()));
        }
コード例 #18
0
        public void ConfigureContainer(ServiceConfigurationContext context)
        {
            var styleGuideShouldBeConfigured = HostingEnvironment.IsProd == false;

            if (styleGuideShouldBeConfigured)
            {
                string featuresRootPath           = "~/Features";
                string componentFileNameExtension = ".styleguide.json";
                string layoutPath = "~/Features/Styleguide/Layout.cshtml";

                var container = context.StructureMap();
                container.ConfigureStyleguide(featuresRootPath, componentFileNameExtension, layoutPath);

                container.Configure(config =>
                {
                    config.For <IStyleguideComponentLoader>().Configure(c => c.RemoveAll());
                    config.For <IStyleguideComponentLoader>().Use(c => new MvcPartialComponentLoader(
                                                                      HttpContext.Current.Server.MapPath(featuresRootPath), componentFileNameExtension,
                                                                      new JsonSerializerSettings
                    {
                        TypeNameHandling = TypeNameHandling.Auto,

                        Converters = new List <JsonConverter>
                        {
                            c.GetInstance <ContentConverter>(),
                            c.GetInstance <ContentReferenceConverter>(),
                            c.GetInstance <ContentAreaConverter>()
                        }
                    }, layoutPath));
                });
            }
        }
コード例 #19
0
 public void ConfigureContainer(ServiceConfigurationContext context)
 {
     DependencyResolver.SetResolver(new StructureMapDependencyResolver(context.StructureMap()));
     context.ConfigurationComplete += (o, e) =>
     {
     };
 }
        public void ConfigureContainer(ServiceConfigurationContext context)
        {
            DependencyResolver.SetResolver(
                new StructureMapDependencyResolver(context.StructureMap()));

            //...an example of registering custom services
            //context.Services.AddSingleton<ICurrentMarket, MyCustomCurrentMarket>();
        }
コード例 #21
0
        public void ConfigureContainer(ServiceConfigurationContext context)
        {
            var container = context.StructureMap();

            container.Configure(ConfigureContainer);

            DependencyResolver.SetResolver(new StructureMapDependencyResolver(container));
        }
コード例 #22
0
 public void ConfigureContainer(ServiceConfigurationContext context)
 {
     context.StructureMap().Configure(x =>
     {
         x.For <ICatalogImporter>().Use <CatalogImporter>();
         x.For <ICatalogService>().Use <CatalogService>();
     });
 }
コード例 #23
0
        public void ConfigureContainer(ServiceConfigurationContext context)
        {
            context.Services
            .AddTransient <ISetupCmsContentMigration, SetupCmsContentMigration>()
            .AddTransient <ISetupCommerceContentMigration, SetupCommerceContentMigration>()
            .AddTransient <IApplication, Application>();

            Program.Container = context.StructureMap();
        }
コード例 #24
0
        public void ConfigureContainer(ServiceConfigurationContext context)
        {
            context.Services.AddSingleton(c => context);
            new AppBootstrapper().RegisterDependencies(context.Services);
            var resolver = new StructureMapDependencyResolver(context.StructureMap());

            DependencyResolver.SetResolver(resolver);
            GlobalConfiguration.Configuration.DependencyResolver = resolver;
        }
 public void ConfigureContainer(ServiceConfigurationContext context)
 {
     DependencyResolver.SetResolver(
         new StructureMapDependencyResolver(context.StructureMap()));
     //Implementations for custom interfaces can be registered here.
     context.ConfigurationComplete += (o, e) =>
     {
     };
 }
コード例 #26
0
        public void ConfigureContainer(ServiceConfigurationContext context)
        {
            DependencyResolver.SetResolver(new StructureMapDependencyResolver(context.StructureMap()));

            context.ConfigurationComplete += (o, e) =>
            {
                //Register custom implementations that should be used in favour of the default implementations
            };
        }
コード例 #27
0
        public void ConfigureContainer(ServiceConfigurationContext context)
        {
            DependencyResolver.SetResolver(
                new StructureMapDependencyResolver(context.StructureMap()));

            context.ConfigurationComplete += (o, e) =>
            {
                //register custom implementations over default implementation
            };
        }
コード例 #28
0
 /// <summary>
 /// Configures the service container.
 /// </summary>
 /// <param name="context">The context.</param>
 public void ConfigureContainer(ServiceConfigurationContext context)
 {
     context.StructureMap().Configure(ce =>
     {
         ce.For <IConfigurationProvider>().Use <DatabaseConfigurationProvider>();
         ce.For <IContextProvider>().Use <ContentContextProvider>();
         ce.For <IRenderingService>().Use <RenderingService>();
         ce.For <ICodeBuilder>().Use <CodeBuilder>();
     });
 }
        public void ConfigureContainer(ServiceConfigurationContext context)
        {
            DependencyResolver.SetResolver(new StructureMapDependencyResolver(context.StructureMap()));

            context.Services.AddSingleton <IPriceOptimizer, DemoPriceOptimizer>();

            //context.Services.AddSingleton<IPriceService, MyPriceService>();

            //context.Services.AddSingleton<PromotionEngineContentLoader, CustomPromotionEngineContentLoader>();
        }
コード例 #30
0
        public void ConfigureContainer(ServiceConfigurationContext context)
        {
            var container = context.StructureMap();

            container.Configure(x =>
            {
                x.For <IContentRenderer>().Use <ErrorHandlingContentRenderer>();
                x.For <ContentAreaRenderer>().Use <AlloyContentAreaRenderer>();
            });

            DependencyResolver.SetResolver(new StructureMapDependencyResolver(container));
        }