• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Lifestyle类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Lifestyle的典型用法代码示例。如果您正苦于以下问题:C# Lifestyle类的具体用法?C# Lifestyle怎么用?C# Lifestyle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Lifestyle类属于命名空间,在下文中一共展示了Lifestyle类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Register

        private static void Register(Type interfaceType, Lifestyle lifestyle, List<Type> types)
        {
            if (!DuplicateImplementationsExists(types))
            {
                foreach (var type in types)
                {
                    var typeInterface = type.GetInterfaces().First(x => x.Name == interfaceType.Name);

                    var registerOptions = TinyIoCContainer.Current.Register(typeInterface, type);
                    if (lifestyle == Lifestyle.PerRequest)
                        registerOptions.AsMultiInstance();
                    else
                    {
                        registerOptions.AsSingleton();
                    }
                }
            }
            else
            {
                var multiRegisterOptions = TinyIoCContainer.Current.RegisterMultiple(interfaceType, types);
                if (lifestyle == Lifestyle.PerRequest)
                    multiRegisterOptions.AsMultiInstance();
                else
                {
                    multiRegisterOptions.AsSingleton();
                }
            }
        }
开发者ID:jenspettersson,项目名称:Argentum,代码行数:28,代码来源:GenericRegistrator.cs


示例2: ContainerComponentAttribute

		/// <summary>
		/// 	Configures component with default service type (first not-IConrainerBound interface) with no name and default Priority/Lifestyle
		/// </summary>
		public ContainerComponentAttribute(Type serviceType = null, Lifestyle lifestyle = Lifestyle.Default, string name = "",
		                                   int priority = -1) {
			Priority = priority; //default component level for manifest (assembly level will be used)
			Lifestyle = lifestyle;
			Name = name;
			ServiceType = serviceType; //will be resolved automatically
		}
开发者ID:Qorpent,项目名称:qorpent.sys,代码行数:10,代码来源:ContainerComponentAttribute.cs


示例3: Initialize

 public static void Initialize(Container container, Lifestyle lifestyle)
 {
     container.Register<IProdutoRepository, ProdutoRepository>(lifestyle);
     container.Register<ICompraRepository, CompraRepository>(lifestyle);
     container.Register<ICompraItemRepository, CompraItemRepository>(lifestyle);
     container.Register<IFornecedorRepository, FornecedorRepository>(lifestyle);
 }
开发者ID:rodneymanao,项目名称:NetCoders.DDD,代码行数:7,代码来源:RepositoryContainer.cs


示例4: frmSelectLifestyleAdvanced

 public frmSelectLifestyleAdvanced(Lifestyle objLifestyle, Character objCharacter)
 {
     InitializeComponent();
     LanguageManager.Instance.Load(GlobalOptions.Instance.Language, this);
     _objCharacter = objCharacter;
     _objLifestyle = objLifestyle;
     MoveControls();
 }
开发者ID:Nitsuj83,项目名称:chummer5a,代码行数:8,代码来源:frmSelectLifestyleAdvanced.cs


示例5: RegisterItems

        public static Container RegisterItems(Container container, Lifestyle lifeStyle)
        {
            RegisterItemsDataAccess(container, lifeStyle);
            RegisterItemsDataBusiness(container, lifeStyle);


            return container;
        }
开发者ID:fjvela,项目名称:dotnet-ef-ioc-mvc-webapi-worker-nlayers,代码行数:8,代码来源:SimpleInjectorCommon.cs


示例6: frmSelectAdvancedLifestyle

 public frmSelectAdvancedLifestyle(Lifestyle objLifestyle, Character objCharacter)
 {
     InitializeComponent();
     LanguageManager.Instance.Load(this);
     _objCharacter = objCharacter;
     _objLifestyle = objLifestyle;
     MoveControls();
 }
开发者ID:janhelke,项目名称:chummer2,代码行数:8,代码来源:frmSelectAdvancedLifestyle.cs


示例7: Register

 public static void Register(Container container, Lifestyle lifestyle)
 {
     //container.RegisterAll<IConexao<T>>(Conexao<T>)>(lifestyle);
     container.Register<ICompraDal, CompraDal>(lifestyle);
     container.Register<ICompraItemDal, CompraItemDal>(lifestyle);
     container.Register<IClienteDal, ClienteDal>(lifestyle);
     container.Register<IFornecedorDal, FornecedorDal>(lifestyle);
 }
开发者ID:MackMendes,项目名称:NetCoders.MicroErp,代码行数:8,代码来源:DalContainer.cs


示例8: TornLifestyleDiagnosticResult

 internal TornLifestyleDiagnosticResult(Type serviceType, string description, Lifestyle lifestyle,
     Type implementationType, InstanceProducer[] affectedRegistrations)
     : base(serviceType, description, DiagnosticType.TornLifestyle, DiagnosticSeverity.Warning,
         CreateDebugValue(implementationType, lifestyle, affectedRegistrations))
 {
     this.Lifestyle = lifestyle;
     this.ImplementationType = implementationType;
     this.AffectedRegistrations = new ReadOnlyCollection<InstanceProducer>(affectedRegistrations.ToList());
 }
开发者ID:MichaelSagalovich,项目名称:SimpleInjector,代码行数:9,代码来源:TornLifestyleDiagnosticResult.cs


示例9: ExpressionBuildingEventArgs

        internal ExpressionBuildingEventArgs(Type registeredServiceType, Type knownImplementationType, 
            Expression expression, Lifestyle lifestyle)
        {
            this.RegisteredServiceType = registeredServiceType;
            this.KnownImplementationType = knownImplementationType;
            this.Lifestyle = lifestyle;

            this.expression = expression;
        }
开发者ID:bcraun,项目名称:SimpleInjector,代码行数:9,代码来源:ExpressionBuildingEventArgs.cs


示例10: RegisterApp

        public static void RegisterApp(this Container container, Lifestyle lifestyle)
        {
            container.Register<CursoAngularJsContext>(lifestyle);
            container.BatchRegister<ClienteRepository>();
            container.BatchRegister<ClienteApplicationService>();

            ServiceLocator.SetLocatorProvider(
                () => new Adapters.SimpleInjectorServiceLocatorAdapter(container));
        }
开发者ID:brunomantovani,项目名称:CursoAngularEzconet,代码行数:9,代码来源:Startup.cs


示例11: ExpressionRegistration

        internal ExpressionRegistration(Expression expression, Type implementationType, Lifestyle lifestyle, 
            Container container)
            : base(lifestyle, container)
        {
            Requires.IsNotNull(expression, nameof(expression));
            Requires.IsNotNull(implementationType, nameof(implementationType));

            this.expression = expression;
            this.implementationType = implementationType;
        }
开发者ID:khellang,项目名称:SimpleInjector,代码行数:10,代码来源:ExpressionRegistration.cs


示例12: RegisterModelDependencies

 public static void RegisterModelDependencies(this Container container, Lifestyle lifestyle)
 {
     container.Register<AdvertiserAccountService, AdvertiserAccountService>(lifestyle);
     container.Register<CryptographyService, CryptographyService>(lifestyle);
     container.Register<AuthenticationService, AuthenticationService>(lifestyle);
     container.Register<LocationService, LocationService>(lifestyle);
     container.Register<ServiceSolicitationService, ServiceSolicitationService>(lifestyle);
     container.Register<ContractModelService,ContractModelService>(lifestyle);
     container.Register<AdvertisementService, AdvertisementService>(lifestyle);
 }
开发者ID:RicardoAnz,项目名称:UnivaliVoceViu2014,代码行数:10,代码来源:Setup.cs


示例13: DefaultComponentProfile

        public DefaultComponentProfile( String key, Type service, Type implementation,
			Lifestyle lifestyle, Activation activation, IConfiguration configuration )
        {
            m_key = key;
            m_service = service;
            m_implementation = implementation;
            m_lifestyle = lifestyle;
            m_activation = activation;
            m_configuration = configuration;
        }
开发者ID:BackupTheBerlios,项目名称:dpml-svn,代码行数:10,代码来源:DefaultComponentProfile.cs


示例14: DecoratorExpressionInterceptorData

 public DecoratorExpressionInterceptorData(Container container, Type serviceType, Type decoratorType,
     Predicate<DecoratorPredicateContext> predicate, Lifestyle lifestyle,
     Func<DecoratorPredicateContext, Type> decoratorTypeFactory = null)
 {
     this.Container = container;
     this.ServiceType = serviceType;
     this.DecoratorType = decoratorType;
     this.DecoratorTypeFactory = this.WrapInNullProtector(decoratorTypeFactory);
     this.Predicate = predicate;
     this.Lifestyle = lifestyle;
 }
开发者ID:khellang,项目名称:SimpleInjector,代码行数:11,代码来源:DecoratorExpressionInterceptorData.cs


示例15: Register

        public static void Register(Container container, Lifestyle lifeStyleDbContext)
        {
            //Containers.ApplicationServiceContainer.RegisterApplicationService(container);
            container.RegisterApplicationServices();
            container.RegisterDomainServices();
            container.RegisterRepositories();

            container.RegisterDbContexts(lifeStyleDbContext);

            ServiceLocatorConfig(container);
        }
开发者ID:seanomisteal,项目名称:DDDTurma2015-04-11,代码行数:11,代码来源:Startup.cs


示例16: RegisterItemsDataAccess

        private static void RegisterItemsDataAccess(Container container, Lifestyle lifeStyle)
        {
            container.Register<IPersonRepository, PersonRepository>(lifeStyle);
            //container.Register<typeof(AdventureContext), AdventureContext > (lifeStyle);
            container.Register<DbContext, AdventureContext>(lifeStyle);
            container.Register<IUnitOfWork, UnitOfWork>(lifeStyle);

            //builder.RegisterType(typeof(SampleArchContext)).As(typeof(DbContext)).InstancePerLifetimeScope();
            //builder.RegisterType(typeof(UnitOfWork)).As(typeof(IUnitOfWork)).InstancePerRequest();

        }
开发者ID:fjvela,项目名称:dotnet-ef-ioc-mvc-webapi-worker-nlayers,代码行数:11,代码来源:SimpleInjectorCommon.cs


示例17: AmbiguousLifestylesDiagnosticResult

 internal AmbiguousLifestylesDiagnosticResult(Type serviceType, string description, 
     Lifestyle[] lifestyles, Type implementationType, InstanceProducer diagnosedProducer, 
     InstanceProducer[] conflictingProducers)
     : base(serviceType, description, DiagnosticType.AmbiguousLifestyles, DiagnosticSeverity.Warning,
         CreateDebugValue(implementationType, lifestyles, conflictingProducers))
 {
     this.Lifestyles = new ReadOnlyCollection<Lifestyle>(lifestyles.ToList());
     this.ImplementationType = implementationType;
     this.DiagnosedRegistration = diagnosedProducer;
     this.ConflictingRegistrations = new ReadOnlyCollection<InstanceProducer>(conflictingProducers.ToList());
 }
开发者ID:bluexary,项目名称:SimpleInjector,代码行数:11,代码来源:AmbiguousLifestylesDiagnosticResult.cs


示例18: RegisterServices

        private static void RegisterServices(Container container, Assembly assembly, Lifestyle lifestyle)
        {
            var registrations = assembly.GetExportedTypes()
                                 .Where(t => t.GetInterfaces().Any())
                                 .Select(t => new { Service = t.GetInterfaces().Single(), Implementation = t });

            foreach (var reg in registrations)
            {
                container.Register(reg.Service, reg.Implementation, lifestyle);
            }
        }
开发者ID:ninjanomnom,项目名称:EloHeaven,代码行数:11,代码来源:DependencyInjectionConfig.cs


示例19: Bootstrap

        public static void Bootstrap(Container container, Lifestyle lifestyle)
        {
            container.RegisterApplicationServices();
            container.RegisterDomainServices();
            container.RegisterRepositories();
            container.RegisterDbContexts(lifestyle);
            container.RegisterUnitsOfWork();

            ServiceLocator.SetLocatorProvider(
                () => new Adapters.SimpleInjectorServiceLocatorAdapter(container));
        }
开发者ID:brunomantovani,项目名称:CursoDDDTurma13-07-2015,代码行数:11,代码来源:IoCStartup.cs


示例20: HybridRegistration

 public HybridRegistration(Type serviceType, Type implementationType, Func<bool> test,
     Registration trueRegistration, Registration falseRegistration,
     Lifestyle lifestyle, Container container)
     : base(lifestyle, container)
 {
     this.serviceType = serviceType;
     this.implementationType = implementationType;
     this.test = test;
     this.trueRegistration = trueRegistration;
     this.falseRegistration = falseRegistration;
 }
开发者ID:BrettJaner,项目名称:SimpleInjector,代码行数:11,代码来源:HybridRegistration.cs



注:本文中的Lifestyle类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Lifetime类代码示例发布时间:2022-05-24
下一篇:
C# License类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap