当前位置: 首页>>代码示例>>C#>>正文


C# Lifestyle类代码示例

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


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


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