當前位置: 首頁>>代碼示例>>C#>>正文


C# Container.InterceptWith方法代碼示例

本文整理匯總了C#中SimpleInjector.Container.InterceptWith方法的典型用法代碼示例。如果您正苦於以下問題:C# Container.InterceptWith方法的具體用法?C# Container.InterceptWith怎麽用?C# Container.InterceptWith使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SimpleInjector.Container的用法示例。


在下文中一共展示了Container.InterceptWith方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: InitContanier

 private static Container InitContanier()
 {
     var container = new Container();
     container.Register<ILogger, ConsoleLogger>();
     container.Register<ICredit, Credit>();
     //container.Register<IInterceptor,PerformanceLoggingInterceptor>();
     container.InterceptWith<PerformanceLoggingInterceptor>(type => type== typeof(ICredit));
     return container;
 }
開發者ID:ilkerhalil,項目名稱:SimpleInjector_Interception_Sample,代碼行數:9,代碼來源:Program.cs

示例2: Prepare

        public override void Prepare()
        {
            this.container = new SimpleInjector.Container();

            this.container.RegisterSingle<ISingleton, Singleton>();
            this.container.Register<ITransient, Transient>();
            this.container.Register<ICombined, Combined>();
            this.container.Register<ICalculator, Calculator>();

            container.InterceptWith<SimpleInjectorInterceptionLogger>(type => type == typeof(ICalculator));

            this.container.Verify();
        }
開發者ID:junxy,項目名稱:IocPerformance,代碼行數:13,代碼來源:SimpleInjectorContainerAdapter.cs

示例3: InitializeContainer

        private static void InitializeContainer(Container container)
        {
            // Infrastructure
            container.Register<IApiConfigurationProvider, AzureApiConfigurationProvider>();
            container.Register<IMappingEngine, MappingEngine>(Lifestyle.Singleton);
            container.Register<IMapper, PortalMapper>(Lifestyle.Singleton);
            container.Register<IConfigurationProvider, ConfigurationProvider>();
            container.Register<IPortalSettings, PortalSettings>();


            // DAL Infrastructure
            container.Register(() => new MongoUrl(container.GetInstance<IApiConfigurationProvider>().MongoConnectionString));
            container.RegisterSingle<ITrackingUrlIdGenerator, TrackingUrlIdGenerator>();

            // DAL
            container.Register<IRepositoryFactory, RepositoryFactory>();
            container.Register<ITrackingUrlRepository, TrackingUrlRepository>();
            container.Register<ITrackingStatRepository, TrackingStatRepository>();
            container.Register<IBalanceHistoryRepository, BalanceHistoryRepository>();
            container.Register<ICompanyRepository, CompanyRepository>();


            // BLL Infrastructure
            container.Register<IUrlShortenerService, UrlShortenerService>(Lifestyle.Singleton);
            container.Register<IProjectUriProvider>(() => new ProjectUriProvider(
                container.GetInstance<IApiConfigurationProvider>().ProjectBaseUri), Lifestyle.Singleton);

            // Email
            container.Register(() => container.GetInstance<IPortalSettings>().MailSettings);
            container.Register<IEmailInitializer, EmailInitializer>();
            container.Register<IEmailFactory, SmtpEmailFactory>();
            container.Register<IMailerRepository, MailerRepository>();
            container.Register<IStringEncryptor, StringEncryptor>();
            container.Register<IEmailSenderService, EmailSenderService>();

            // BLL
            container.Register<IBalanceService, BalanceService>();
            container.Register<IUrlTrackingService, UrlTrackingService>();
            container.Register<IUrlTrackingStatService, UrlTrackingStatService>();
            container.Register<ICompanyService, CompanyService>();
            container.Register<ISubscriptionService, SubscriptionService>();


            // BLL Billing
            container.Register<IBillingCardService>(
                () =>
                    new StripeBillingCardService(container.GetInstance<IApiConfigurationProvider>().StripeApiKey,
                        container.GetInstance<IMapper>()));
            container.Register<IBillingChargeService>(
                () =>
                    new StripeBillingChargeService(container.GetInstance<IApiConfigurationProvider>().StripeApiKey,
                        container.GetInstance<IMapper>()));
            container.Register<IBillingCustomerService>(
                () =>
                    new StripeBillingCustomerService(container.GetInstance<IApiConfigurationProvider>().StripeApiKey,
                        container.GetInstance<IMapper>()));
            container.Register<IBillingEventService>(
                () =>
                    new StripeBillingEventService(container.GetInstance<IApiConfigurationProvider>().StripeApiKey,
                        container.GetInstance<IMapper>()));


            // Interceptions
            container.InterceptWith<UrlTrackingServiceStatInterceptor>(type => type == typeof (IUrlTrackingService));
            container.RegisterSingle<UrlTrackingServiceStatInterceptor>();
        }
開發者ID:GusLab,項目名稱:video-portal,代碼行數:66,代碼來源:SimpleInjectorInitializer.cs


注:本文中的SimpleInjector.Container.InterceptWith方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。