本文整理汇总了C#中IWindsorContainer类的典型用法代码示例。如果您正苦于以下问题:C# IWindsorContainer类的具体用法?C# IWindsorContainer怎么用?C# IWindsorContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IWindsorContainer类属于命名空间,在下文中一共展示了IWindsorContainer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Install
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.Register(Classes.FromThisAssembly()
.BasedOn<IController>()
.LifestyleTransient());
container.Register(Component
.For<IControllerFactory>()
.UsingFactoryMethod(_ => new WindsorControllerFactory(container))
.LifeStyle.Singleton);
container.Register(Component.For<IRdfTranslator>()
.UsingFactoryMethod(_ => new RdfTranslator(container.Resolve<IMongoDataContextProvider>()))
.LifeStyle.PerWebRequest);
container.Register(Component.For<IMongoDataContextProvider>()
.UsingFactoryMethod(_ => new MongoDataContextProvider())
.LifeStyle.PerWebRequest);
//container.Register(Component.For<IFormsAuthenticationService>()
// .UsingFactoryMethod(_ => new FormsAuthenticationService())
// .LifeStyle.PerWebRequest);
//container.Register(Component.For<IMembershipService>()
// .UsingFactoryMethod(_ => new AccountMembershipService())
// .LifeStyle.PerWebRequest);
}
示例2: AddComponentsTo
public static void AddComponentsTo(IWindsorContainer container)
{
AddGenericRepositoriesTo(container);
container.Register(Component.For<IValidator>().ImplementedBy<Validator>().Named("validator"));
container.Register(Component.For<IDbContext>().ImplementedBy<DbContext>().Named("dbContext"));
}
示例3: AddApplicationServicesTo
private static void AddApplicationServicesTo(IWindsorContainer container)
{
container.Register(
AllTypes.Pick()
.FromAssemblyNamed("Anuncios.ApplicationServices")
.WithService.FirstInterface());
}
示例4: Install
public void Install(IWindsorContainer container)
{
container.Register(
Component.For<IAuthenticationUserViewUserService>().ImplementedBy<AuthenticationUserViewUserService>().LifeStyle.PerThread,
Component.For<IAuthenticationUserViewRoleService>().ImplementedBy<AuthenticationUserViewRoleService>().LifeStyle.PerThread
);
}
示例5: RemoveDigestAuthorisationContributor
/// <summary>
/// http://trac.caffeine-it.com/openrasta/ticket/118#comment:1
/// See OpenRasta.DigestAuthorizerContributor.WriteCredentialRequest
/// TODO: Need to implement
/// </summary>
public static void RemoveDigestAuthorisationContributor(IWindsorContainer container)
{
var contributors = container.Kernel.GetHandlers(typeof(IPipelineContributor));
var digestContributor = contributors.SingleOrDefault(i => i.ComponentModel.Implementation == typeof(DigestAuthorizerContributor));
container.Kernel.RemoveComponent(digestContributor.ComponentModel.Name);
}
示例6: Install
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.Register(
AllTypes.FromAssemblyNamed("SharpArchTemplate.Web.Mvc")
.InNamespace("SharpArchTemplate.Web.Mvc.Controllers.Queries", true)
.WithService.DefaultInterfaces());
}
示例7: Install
public void Install(IWindsorContainer container)
{
container.Register(
Component.For<ILoginUserService>().ImplementedBy<LoginUserService>().LifeStyle.PerWebRequest,
Component.For<ILoginRoleService>().ImplementedBy<LoginRoleService>().LifeStyle.PerWebRequest
);
}
示例8: Install
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.Register(
Component.For<IConfigureWiringForTests, IResetTestDatabases>()
.Instance(new DocumentDbTestConfigurer(container))
);
}
开发者ID:RichieYang,项目名称:Composable.Monolithic,代码行数:7,代码来源:InMemoryAccountManagementQuerymodelsSessionInstaller.cs
示例9: Install
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.Register(
Classes.FromThisAssembly().BasedOn<IInitialiser>().WithService.FromInterface(),
Component.For<IList<IInitialiser>>().UsingFactoryMethod<List<IInitialiser>>(
c => new List<IInitialiser>(c.ResolveAll<IInitialiser>())));
}
示例10: Configure
public static void Configure(IWindsorContainer container)
{
Mapper.Initialize(x => x.ConstructServicesUsing(type => ResolveType(container, type)));
Mapper.CreateMap<User, UserListItemViewModel>();
Mapper.CreateMap<Task, TaskListItemViewModel>();
Mapper.CreateMap<Task, TaskInputViewModel>()
.ForMember(m => m.AvaiableProjects, opt => opt.ResolveUsing<AvaiableProductsResolver>().FromMember(x => x.Owner.Id));
Mapper.CreateMap<TaskInputViewModel, Task>()
.ForMember(m => m.Owner, o => o.ResolveUsing<LoadingEntityResolver<User>>().FromMember(x => x.OwnerId))
.ForMember(m => m.Project, o => o.ResolveUsing<LoadingEntityResolver<Project>>().FromMember(x => x.ProjectId));
Mapper.CreateMap<Project, ProjectListItemViewModel>();
Mapper.CreateMap<Project, ProjectViewModel>();
Mapper.CreateMap<Project, ProjectInputViewModel>()
.ForMember(m => m.SelectedOwnerId, o => o.MapFrom(x => x.Owner.Id))
.ForMember(m => m.SelectedParticipants, o => o.MapFrom(x => x.Participants.Select(p => p.Id)))
.ForMember(m => m.AvaiableOwners, opt => opt.ResolveUsing<AvaiableProductOwnersResolver>())
.ForMember(m => m.AvaiableParticipants, opt => opt.ResolveUsing<AvaiableProductOwnersResolver>());
Mapper.CreateMap<ProjectInputViewModel, Project>()
.ForMember(m => m.Owner, o => o.ResolveUsing<LoadingEntityResolver<User>>().FromMember(x => x.SelectedOwnerId))
.ForMember(dst => dst.Participants, opt => opt.ResolveUsing<LoadingCollectionEntityResolver<User>>().FromMember(x => x.SelectedParticipants))
.ForMember(dst => dst.Tasks, opt => opt.Ignore());
}
示例11: Install
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.Register(
Component.For(typeof (ICustomWindowManager), typeof (IWindowManager)).ImplementedBy<CustomWindowManager>().LifeStyle.Is(LifestyleType.Singleton),
Component.For<IEventAggregator>().ImplementedBy<EventAggregator>().LifeStyle.Is(LifestyleType.Singleton)
);
}
示例12: ConfigMetadata
private static void ConfigMetadata(IModelRegistrar reg, IWindsorContainer container)
{
reg.ModelNamespacePattern("Centros.Model.{0}, Centros.Model");
reg.RegisterPatterApplier(new IdPatternApplier { IdPropertyName = "Id" });
reg.RegisterPatterApplier(new ReferencePatternApplier { ExcludeReferenceTypes = new[] { typeof(Horario) } });
reg.DomainAccessorAccessor(modelType =>
{
var providerType = typeof (IDomainAccessor<>).MakeGenericType(modelType);
return (IDomainAccessor<object>) container.Resolve(providerType);
}).
DomainMutatorAccessor(modelType =>
{
var providerType = typeof (IDomainMutator<>).MakeGenericType(modelType);
return (IDomainMutator<object>) container.Resolve(providerType);
});
reg.ForType<Centro>();
reg.ForType<Educador>();
reg.ForType<Horario>();
reg.ForType<Institucion>(md => md.Description("Institución"));
reg.ForType<Jurisdiccion>(md => md.Description("Jurisdicción"));
reg.ForType<Organizacion>(md => md.Description("Organización"));
reg.ForType<Participacion>();
reg.ForType<Participante>();
reg.ForType<Registro>();
reg.ForType<Taller>();
}
示例13: AddGenericRepositoriesTo
private static void AddGenericRepositoriesTo(IWindsorContainer container)
{
container.Register(
Component
.For(typeof(IEntityDuplicateChecker))
.ImplementedBy(typeof(EntityDuplicateChecker))
.Named("entityDuplicateChecker"));
container.Register(
Component
.For(typeof(IRepository<>))
.ImplementedBy(typeof(Repository<>))
.Named("repositoryType"));
container.Register(
Component
.For(typeof(INHibernateRepository<>))
.ImplementedBy(typeof(NHibernateRepository<>))
.Named("nhibernateRepositoryType"));
container.Register(
Component
.For(typeof(IRepositoryWithTypedId<,>))
.ImplementedBy(typeof(RepositoryWithTypedId<,>))
.Named("repositoryWithTypedId"));
container.Register(
Component
.For(typeof(INHibernateRepositoryWithTypedId<,>))
.ImplementedBy(typeof(NHibernateRepositoryWithTypedId<,>))
.Named("nhibernateRepositoryWithTypedId"));
}
示例14: Install
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.Register(Component
.For<IDatabaseContext>()
.ImplementedBy<DatabaseContext>()
.DependsOn(Dependency.OnValue("nameOrConnectionString", "DefaultConnection"))
.LifeStyle.Transient
);
container.Register(Component
.For<IUserStore>()
.ImplementedBy<UserStore>()
.LifeStyle.Transient);
container.Register(Component
.For<IPostStore>()
.ImplementedBy<PostStore>()
.LifeStyle.Transient
);
container.Register(Component
.For<IUnitOfWork>()
.ImplementedBy<UnitOfWork>()
.LifeStyle.Transient
);
}
示例15: Install
public void Install(IWindsorContainer container)
{
container.Register(
AllTypes.FromThisAssembly().BasedOn<IEmailTemplateManagementDatabaseFactory>().Configure(
component =>
{
component.Named(component.Implementation.Name);
component.LifeStyle.Is(LifestyleType.Thread);
}).WithService.Base(),
AllTypes.FromThisAssembly().BasedOn<IEmailTemplateManagementUnitOfWork>().Configure(
component =>
{
component.Named(component.Implementation.Name);
component.LifeStyle.Is(LifestyleType.Thread);
}).WithService.Base(),
AllTypes.FromThisAssembly().BasedOn<IEmailTemplateManagementTemplateRepository>().Configure(
component =>
{
component.Named(component.Implementation.Name);
component.LifeStyle.Is(LifestyleType.Thread);
}).WithService.Base(),
AllTypes.FromThisAssembly().BasedOn<IProvideEmailTemplateManagementSessionFactoryInitialisation>().Configure(
component =>
{
component.Named(component.Implementation.Name);
component.LifeStyle.Is(LifestyleType.Thread);
}).WithService.Base()
);
}