public static void Configure(Microsoft.Practices.Unity.IUnityContainer container) { if (QMailer.GlobalConfiguration.Configuration.DependencyResolver == null) { QMailer.GlobalConfiguration.Configuration.DependencyResolver = new QMailer.UnityDependencyResolver(container); } var emailEngines = new ViewEngineCollection() { new EmailerViewEngine() }; var ic = new InjectionConstructor(emailEngines, GlobalConfiguration.Configuration.FullUrl ?? "http://localhost", GlobalConfiguration.Configuration.VirtualPath); container.RegisterType <IEmailViewRenderer, EmailViewRenderer>("default", new ContainerControlledLifetimeManager(), ic); container.RegisterType <IEmailTemplateService, EmailTemplateService>(new ContainerControlledLifetimeManager()); container.RegisterType <ICacheService, SimpleCacheService>(new ContainerControlledLifetimeManager()); if (!container.IsRegistered <QMailer.Web.IModelResolver>()) { container.RegisterType <IModelResolver, DefaultModelResolver>(new ContainerControlledLifetimeManager()); } }
public static void Configure(Microsoft.Practices.Unity.IUnityContainer container) { string configurationFilePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Unity.config"); var configurationFileMap = new ExeConfigurationFileMap { ExeConfigFilename = configurationFilePath }; var configuration = ConfigurationManager.OpenMappedExeConfiguration(configurationFileMap, ConfigurationUserLevel.None); var section = (Microsoft.Practices.Unity.Configuration.UnityConfigurationSection)configuration.GetSection("unity"); section.Configure(container); var config = ConfigurationManager.GetSection("applicationConfig") as ApplicationConfig; container.RegisterInstance <ApplicationConfig>(config); ITypeFinder typeFinder = new WebTypeFinder(); container.RegisterInstance <ITypeFinder>(typeFinder); var registerTypes = typeFinder.FindClassesOfType <IDependencyRegister>(); foreach (Type registerType in registerTypes) { var register = (IDependencyRegister)Activator.CreateInstance(registerType); register.RegisterTypes(container); } }
private static void RegisterTypes(Microsoft.Practices.Unity.IUnityContainer container) { UnityServiceBootstrapper.RegisterTypes(container); // NOTE: To load from web.config uncomment the line below. Make sure to add a Microsoft.Practices.Unity.Configuration to the using statements. // container.LoadConfiguration(); }
public void Process(Microsoft.Practices.Unity.IUnityContainer container) { container.RegisterType(typeof(Sitecore.Ecommerce.Catalogs.ProductUrlProcessor), typeof(NameAndVariantProductUrlProcessor), "Item Name and Variant", new HierarchicalLifetimeManager(), new InjectionMember[] { new InjectionConstructor(new ResolvedParameter <Sitecore.Ecommerce.Search.ISearchProvider>("CompositeSearchProvider")), new InjectionProperty("ShopContext") }); }
public void Register(Microsoft.Practices.Unity.IUnityContainer container) { //http://stackoverflow.com/questions/4059991/microsoft-unity-how-to-specify-a-certain-parameter-in-constructor container.RegisterType <IDataContextAsync, StripeContext>("dataContextStripe", new PerRequestLifetimeManager()); container.RegisterType <IUnitOfWorkAsync, UnitOfWork>("unitOfWorkStripe", new PerRequestLifetimeManager(), new InjectionConstructor( new ResolvedParameter <Repository.Pattern.DataContext.IDataContextAsync>("dataContextStripe") )); container.RegisterType <IRepositoryAsync <StripeConnect>, Repository <StripeConnect> >( new InjectionConstructor( new ResolvedParameter <IDataContextAsync>("dataContextStripe"), new ResolvedParameter <IUnitOfWorkAsync>("unitOfWorkStripe") )); container.RegisterType <IRepositoryAsync <StripeTransaction>, Repository <StripeTransaction> >( new InjectionConstructor( new ResolvedParameter <IDataContextAsync>("dataContextStripe"), new ResolvedParameter <IUnitOfWorkAsync>("unitOfWorkStripe") )); container.RegisterType <IStripeConnectService, StripeConnectService>(); container.RegisterType <IStripeTransactionService, StripeTransactionService>(); }
public UnityResolver(Unity.IUnityContainer container) { if (container == null) { throw new ArgumentNullException("container"); } this.Container = container; }
/// <summary> /// Registers the type mappings with the Unity container. /// </summary> /// <param name="container">The unity container to configure.</param> /// <remarks> /// There is no need to register concrete types such as controllers or /// API controllers (unless you want to change the defaults), as Unity /// allows resolving a concrete type even if it was not previously /// registered. /// </remarks> public static void RegisterTypes(Microsoft.Practices.Unity.IUnityContainer container) { Registration.Register(container); var mapper = AutoMapperRegister.RegisterServices(container).CreateMapper(); container.RegisterInstance(mapper); }
public void Process(Microsoft.Practices.Unity.IUnityContainer container) { container.RegisterType <Sitecore.Ecommerce.DomainModel.Carts.IShoppingCartManager, ActiveCommerce.Training.HelloWorld.ShoppingCartManager>( new InjectionMember[] { new InjectionProperty("ProductRepository"), new InjectionProperty("ProductPriceManager") } ); }
public void Process(Microsoft.Practices.Unity.IUnityContainer container) { //checkout data holder (session-based) container.RegisterType <ICheckOut, ActiveCommerce.Training.Payment.CheckOut.CheckOut>(); //payment provider container.RegisterType(typeof(Sitecore.Ecommerce.DomainModel.Payments.PaymentProvider), typeof(ActiveCommerce.Training.Payment.InvoicePaymentOption), "InvoicePayment"); }
/// <summary> /// Resolve all the registered instances of type T. /// </summary> /// <typeparam name="T"> Type </typeparam> /// <param name="container">The unity container instance.</param> /// <returns>Collection of resolve type T.</returns> /// <remarks> /// This extension method is a fix for the bug in unity ResolveAll Generic method. /// For more details follow the thread at "http://unity.codeplex.com/workitem/3392" /// </remarks> public static IEnumerable <T> ResolveAll <T>(this Microsoft.Practices.Unity.IUnityContainer container) { IEnumerable <ContainerRegistration> names = container.Registrations.Where(registration => registration.RegisteredType == typeof(T)); foreach (ContainerRegistration registration in names) { yield return(container.Resolve <T>(registration.Name)); } }
public void Process(Microsoft.Practices.Unity.IUnityContainer container) { container.RegisterType(typeof(ActiveCommerce.Products.Comparison.IProductComparer <>), typeof(ActiveCommerce.Training.ComparePrice.ProductComparer <>), new InjectionMember[] { new InjectionProperty("ProductRepository"), new InjectionProperty("LookupResolver") }); }
public void Process(Microsoft.Practices.Unity.IUnityContainer container) { container.RegisterType <ActiveCommerce.Shipping.IShippingService, ActiveCommerce.Training.ShippingIntegration.ShippingService>("training", new InjectionMember[] { new InjectionProperty("Configuration"), new InjectionProperty("Destination"), new InjectionProperty("ShippingWeight") } ); }
public void Process(Microsoft.Practices.Unity.IUnityContainer container) { //map our new CustomerInfo class. injection properties are important. container.RegisterType <Sitecore.Ecommerce.DomainModel.Users.CustomerInfo, ActiveCommerce.Training.CustomerInfo.Users.CustomerInfo>(new InjectionMember[] { new InjectionProperty("BillingAddress"), new InjectionProperty("ShippingAddress") }); }
public void Process(Microsoft.Practices.Unity.IUnityContainer container) { /* * Resolving our repository through unity allows injection of the Active Commerce * ISessionBuilder, which will manage your NHibernate sessions and ensure they are * properly Disposed. */ container.RegisterType <IProductReviewRepository, ProductReviewRepository>(); container.RegisterType <ProductHelper, ProductHelper>(new HierarchicalLifetimeManager()); }
protected override void ConfigureContainer(Microsoft.Practices.Unity.IUnityContainer container) { base.ConfigureContainer(container); container.RegisterType <IDiscountCalculator, CustomDiscountCalculator>(new InjectionFactory(x => { return(new CustomDiscountCalculator()); })); container.RegisterType <ITaxCalculator, CustomTaxCalculator>(new InjectionFactory(x => { return(new CustomTaxCalculator()); })); }
private void ConfigureContainer(IUnityContainer unityContainer, IQuartzConfig quartzConfig, ActorSystem actorSystem) { unityContainer.Register(new GridNodeContainerConfiguration(actorSystem, _transportMode, quartzConfig)); _configuration.Register(unityContainer); var persistentScheduler = System.ActorOf(System.DI().Props <SchedulingActor>(), nameof(SchedulingActor)); unityContainer.RegisterInstance(new TypedMessageActor <ScheduleMessage>(persistentScheduler)); unityContainer.RegisterInstance(new TypedMessageActor <ScheduleCommand>(persistentScheduler)); unityContainer.RegisterInstance(new TypedMessageActor <Unschedule>(persistentScheduler)); unityContainer.RegisterInstance(_messageRouting); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); // Populating UnityContainer with registrations Microsoft.Practices.Unity.IUnityContainer container = Kuff.WebUI.App_Start.DependencyInjectionModule.ConfigureIocContainer(new UnityContainer()); DependencyResolver.SetResolver(new UnityDependencyResolver(container)); IServiceLocator locator = new UnityServiceLocator(container); EnterpriseLibraryContainer.Current = locator; // Initializing EnterpriseLibraryContainer's Container for using ServiceLocator in other layers. //var configurator = new UnityContainerConfigurator(container); //EnterpriseLibraryContainer.ConfigureContainer(configurator, ConfigurationSourceFactory.Create()); //Kuff.WebUI.App_Start.DependencyInjectionModule.ConfigureUiLayerContainer(container); }
public void Process(Microsoft.Practices.Unity.IUnityContainer container) { container.RegisterType(typeof(ICustomerManager <>), typeof(ActiveCommerce.Training.CartPersistence.Users.CustomerManager <>), new HierarchicalLifetimeManager(), new InjectionMember[] { new InjectionProperty("CustomerMembership") }); container.RegisterType( typeof(ActiveCommerce.Web.Models.Factories.IViewModelFactory <ShoppingCart, ShoppingCartViewModel>), typeof(ActiveCommerce.Training.CartPersistence.ViewModel.ShoppingCartViewModelFactory), new HierarchicalLifetimeManager(), new InjectionMember[] { new InjectionProperty("EstimatedCosts", true), new InjectionProperty("ShopContext"), new InjectionProperty("PriceFormatter") } ); }
public void Process(Microsoft.Practices.Unity.IUnityContainer container) { //new base order type container.RegisterType(typeof(Sitecore.Ecommerce.DomainModel.Orders.Order), typeof(ActiveCommerce.Training.OrderExtension.Order), new InjectionMember[] { new InjectionConstructor(new object[] { new ResolvedParameter <OrderStatus>("New") }), new InjectionProperty("OrderLines"), new InjectionProperty("Currency"), new InjectionProperty("CustomerInfo"), new InjectionProperty("NotificationOption"), new InjectionProperty("PaymentSystem"), new InjectionProperty("ShippingProvider"), new InjectionProperty("Totals", new ResolvedParameter(typeof(Totals), "Order")), new InjectionProperty("Status") }); container.RegisterType(typeof(IMappingRule <>), typeof(ActiveCommerce.Training.OrderExtension.OrderMappingRule), "OrderMappingRule", new InjectionProperty("MappingObject")); }
public PluginBuilder(Assembly assembly , Microsoft.Practices.Unity.IUnityContainer container , System.Web.HttpContextBase context , Models.WebSiteSettings webSiteSettings) { this.assembly = assembly; this.m_Container = container; this.m_HttpContext = context; this.m_WebSiteSettings = webSiteSettings; foreach (Type type in assembly.GetExportedTypes()) { if (!type.IsAbstract && typeof(PluginInit).IsAssignableFrom(type)) { pluginTypes.Add(type); } } }
public void Process(Microsoft.Practices.Unity.IUnityContainer container) { //checkout data holder (session-based) container.RegisterType<ICheckOut, ActiveCommerce.GiftMessage.CheckOut.CheckOut>(); //checkout view model -- used for JSON model during checkout container.RegisterType<CheckoutViewModel, ActiveCommerce.GiftMessage.Model.CheckoutViewModel>(); container.RegisterType( typeof(ActiveCommerce.Web.Models.Factories.IViewModelFactory<ShoppingCart, CheckoutViewModel>), typeof(ActiveCommerce.GiftMessage.Model.Factories.CheckoutViewModelFactory), new TransientLifetimeManager(), new InjectionMember[] { new InjectionProperty("ShopContext"), new InjectionProperty("PriceFormatter"), new InjectionProperty("CustomerManager"), new InjectionProperty("ShippingOptionViewModelFactory"), new InjectionProperty("PaymentViewModelFactory"), new InjectionProperty("CartProductViewModelFactory") } ); }
protected override void ConfigureContainer(Microsoft.Practices.Unity.IUnityContainer container) { base.ConfigureContainer(container); //IShippingCalculator baseShippingCalculator = container.Resolve<IShippingCalculator>(); //container.RegisterType<IShippingCalculator, CustomShippingCalculator>(new InjectionFactory(x => //{ // return new CustomShippingCalculator(false); // baseShippingCalculator); //})); container.RegisterType <IDiscountCalculator, CustomDiscountCalculator>(new InjectionFactory(x => { return(new CustomDiscountCalculator()); })); container.RegisterType <ITaxCalculator, CustomTaxCalculator>(new InjectionFactory(x => { return(new CustomTaxCalculator()); })); }
public void Process(Microsoft.Practices.Unity.IUnityContainer container) { //checkout data holder (session-based) container.RegisterType <ICheckOut, ActiveCommerce.GiftMessage.CheckOut.CheckOut>(); //checkout view model -- used for JSON model during checkout container.RegisterType <CheckoutViewModel, ActiveCommerce.GiftMessage.Model.CheckoutViewModel>(); container.RegisterType( typeof(ActiveCommerce.Web.Models.Factories.IViewModelFactory <ShoppingCart, CheckoutViewModel>), typeof(ActiveCommerce.GiftMessage.Model.Factories.CheckoutViewModelFactory), new TransientLifetimeManager(), new InjectionMember[] { new InjectionConstructor(new object[] { new ResolvedParameter <CheckoutViewModel>() }), new InjectionProperty("ShopContext"), new InjectionProperty("PriceFormatter") } ); //new order type container.RegisterType(typeof(Order), typeof(ActiveCommerce.GiftMessage.Orders.Order), new InjectionMember[] { new InjectionConstructor(new object[] { new ResolvedParameter <OrderStatus>("New") }), new InjectionProperty("OrderLines"), new InjectionProperty("Currency"), new InjectionProperty("CustomerInfo"), new InjectionProperty("NotificationOption"), new InjectionProperty("PaymentSystem"), new InjectionProperty("ShippingProvider"), new InjectionProperty("Totals", new ResolvedParameter(typeof(Totals), "Order")), new InjectionProperty("Status") }); //new order-item mapping container.RegisterType(typeof(IMappingRule <>), typeof(ActiveCommerce.GiftMessage.Orders.OrderMappingRule), "OrderMappingRule", new InjectionProperty("MappingObject")); }
public void Initialize(Microsoft.Practices.Unity.IUnityContainer container) { BRE_ResolverProvider.container = container; }
public void Process(Microsoft.Practices.Unity.IUnityContainer container) { container.RegisterType <IAddressValidator, TrainingAddressValidator>(); }
public UnityDependencyResolver(Microsoft.Practices.Unity.IUnityContainer container) { m_Container = container; ConfigureDefaultServices(); }
public UnityApiResolver(Microsoft.Practices.Unity.IUnityContainer container) { _container = container; }
public void Process(Microsoft.Practices.Unity.IUnityContainer container) { container.RegisterType <ActiveCommerce.Taxes.Rates.ISalesTaxRateProvider, TrainingRateProvider>("training"); }
public UnityFilterProvider(Microsoft.Practices.Unity.IUnityContainer container) { m_Container = container; }
public void Process(Microsoft.Practices.Unity.IUnityContainer container) { container.RegisterType <ActiveCommerce.Orders.IOrderFactory, OrderFactory>(new HierarchicalLifetimeManager()); }
public void Process(Microsoft.Practices.Unity.IUnityContainer container) { container.RegisterType <ActiveCommerce.Taxes.ITaxCalculator, TrainingTaxCalculator>("training"); }
public void Process(Microsoft.Practices.Unity.IUnityContainer container) { container.RegisterType <ActiveCommerce.Products.Stock.IProductStockManager, ProductStockManager>(); }
public void Process(Microsoft.Practices.Unity.IUnityContainer container) { //map our new CustomerInfo class. container.RegisterType <Sitecore.Ecommerce.DomainModel.Users.CustomerInfo, ActiveCommerce.Training.CustomerInfo.Users.CustomerInfo>(); }