本文整理汇总了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();
}
}
}
示例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
}
示例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);
}
示例4: frmSelectLifestyleAdvanced
public frmSelectLifestyleAdvanced(Lifestyle objLifestyle, Character objCharacter)
{
InitializeComponent();
LanguageManager.Instance.Load(GlobalOptions.Instance.Language, this);
_objCharacter = objCharacter;
_objLifestyle = objLifestyle;
MoveControls();
}
示例5: RegisterItems
public static Container RegisterItems(Container container, Lifestyle lifeStyle)
{
RegisterItemsDataAccess(container, lifeStyle);
RegisterItemsDataBusiness(container, lifeStyle);
return container;
}
示例6: frmSelectAdvancedLifestyle
public frmSelectAdvancedLifestyle(Lifestyle objLifestyle, Character objCharacter)
{
InitializeComponent();
LanguageManager.Instance.Load(this);
_objCharacter = objCharacter;
_objLifestyle = objLifestyle;
MoveControls();
}
示例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);
}
示例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());
}
示例9: ExpressionBuildingEventArgs
internal ExpressionBuildingEventArgs(Type registeredServiceType, Type knownImplementationType,
Expression expression, Lifestyle lifestyle)
{
this.RegisteredServiceType = registeredServiceType;
this.KnownImplementationType = knownImplementationType;
this.Lifestyle = lifestyle;
this.expression = expression;
}
示例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));
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}