本文整理汇总了C#中IWindsorContainer.AddComponent方法的典型用法代码示例。如果您正苦于以下问题:C# IWindsorContainer.AddComponent方法的具体用法?C# IWindsorContainer.AddComponent怎么用?C# IWindsorContainer.AddComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IWindsorContainer
的用法示例。
在下文中一共展示了IWindsorContainer.AddComponent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Register
public void Register(IWindsorContainer container)
{
container.AddComponent(
"entityDuplicateChecker",
typeof(IEntityDuplicateChecker),
typeof(EntityDuplicateChecker));
container.AddComponent(
"repositoryType",
typeof(IRepository<>),
typeof(Repository<>));
container.AddComponent(
"nhibernateRepositoryType",
typeof(INHibernateRepository<>),
typeof(NHibernateRepository<>));
container.AddComponent(
"repositoryWithTypedId",
typeof(IRepositoryWithTypedId<,>),
typeof(RepositoryWithTypedId<,>));
container.AddComponent(
"nhibernateRepositoryWithTypedId",
typeof(INHibernateRepositoryWithTypedId<,>),
typeof(NHibernateRepositoryWithTypedId<,>));
}
示例2: AddRepositoriesTo
private static void AddRepositoriesTo(IWindsorContainer container)
{
container.AddComponent("repository", typeof(IRepository), typeof(Repository));
container.AddComponent("genericRepository", typeof(IRepository<>), typeof(Repository<>));
container.AddComponent("typedRepository", typeof(IRepositoryWithTypedId<,>),
typeof(RepositoryWithTypedId<,>));
}
示例3: AddComponentsTo
public static void AddComponentsTo(IWindsorContainer container)
{
AddGenericRepositoriesTo(container);
container.AddComponent("validator",
typeof(IValidator), typeof(Validator));
container.AddComponent("dbContext", typeof(IDbContext), typeof(DbContext));
}
示例4: AddComponentsTo
public static void AddComponentsTo(IWindsorContainer container)
{
ParameterCheck.ParameterRequired(container, "container");
if (!container.Kernel.HasComponent("ExceptionLogger")) {
container.AddComponent("ExceptionLogger", typeof(IExceptionLogger), typeof(ExceptionLogger));
container.AddComponent("MethodLogger", typeof(IMethodLogger), typeof(MethodLogger));
}
}
示例5: SetUp
public void SetUp()
{
_container = new WindsorContainer(ConfigHelper.ResolvePath("../Castle.Facilities.Cache.Tests.config"));
_container.AddComponent("ServiceA",typeof(IServiceA), typeof(ServiceA));
_container.AddComponent("ServiceC",typeof(IServiceC), typeof(ServiceC));
_container.AddComponent("ServiceD",typeof(IServiceD), typeof(ServiceD));
ResetConsoleOut();
}
示例6: AddGenericRepositoriesTo
private static void AddGenericRepositoriesTo(IWindsorContainer container) {
container.AddComponent("repositoryType",
typeof(IRepository<>), typeof(Repository<>));
container.AddComponent("nhibernateRepositoryType",
typeof(INHibernateRepository<>), typeof(NHibernateRepository<>));
container.AddComponent("repositoryWithTypedId",
typeof(IRepositoryWithTypedId<,>), typeof(RepositoryWithTypedId<,>));
container.AddComponent("nhibernateRepositoryWithTypedId",
typeof(INHibernateRepositoryWithTypedId<,>), typeof(NHibernateRepositoryWithTypedId<,>));
}
示例7: SetupWindsor
private void SetupWindsor()
{
container = new WindsorContainer(new XmlInterpreter());
var configBuilder = new NHConfigBuilder(Server.MapPath("/"));
container.AddFacility("nhibernate", new NHibernateFacility(configBuilder));
container.AddFacility<TransactionFacility>();
container.AddComponent<TransactionalService>();
container.AddComponent<HomeController>("home");
new SchemaExport(configBuilder.GetConfiguration(null)).Execute(false, true, false);
ControllerBuilder.Current.SetControllerFactory(new WindsorControllerFactory(container));
}
示例8: AddComponentsTo
public static void AddComponentsTo(IWindsorContainer container)
{
//Add your components here
container.AddComponent("validator", typeof(IValidator), typeof(Validator));
container.AddComponent("dbContext", typeof(IDbContext), typeof(DbContext));
container.AddComponent("emailProvider", typeof(IEmailProvider), typeof(EmailProvider));
container.AddComponent("ticketControllerService", typeof (ITicketControllerService),
typeof (TicketControllerService));
AddRepositoriesTo(container);
}
示例9: Init
public void Init()
{
container = new WindsorContainer(ConfigHelper.ResolveConfigPath("Facilities/TypedFactory/typedFactory_castle_config.xml"));
container.AddFacility( "typedfactory", new TypedFactoryFacility() );
container.AddComponent( "miranda", typeof(IProtocolHandler), typeof(MirandaProtocolHandler) );
container.AddComponent( "messenger", typeof(IProtocolHandler), typeof(MessengerProtocolHandler) );
container.AddComponent( "comp1", typeof(IDummyComponent), typeof(Component1) );
container.AddComponent( "comp2", typeof(IDummyComponent), typeof(Component2) );
}
示例10: Init
public void Init()
{
_container = new WindsorContainer( @"..\typedFactory_castle_config.xml" );
_container.AddFacility( "typedfactory", new TypedFactoryFacility() );
_container.AddComponent( "miranda", typeof(IProtocolHandler), typeof(MirandaProtocolHandler) );
_container.AddComponent( "messenger", typeof(IProtocolHandler), typeof(MessengerProtocolHandler) );
_container.AddComponent( "comp1", typeof(IDummyComponent), typeof(Component1) );
_container.AddComponent( "comp2", typeof(IDummyComponent), typeof(Component2) );
}
示例11: Register
public void Register(IWindsorContainer container)
{
container.Register(
AllTypes.Pick()
.FromAssembly(Assembly.GetAssembly(typeof(ControllersRegistrarMarker)))
.If(f => f.Namespace.Contains(".Mappers"))
.WithService.FirstInterface());
container.AddComponent("mapper1", typeof(IMapper<,>), typeof(Mapper<,>));
container.AddComponent("mapper2", typeof(IMapper<,,>), typeof(Mapper<,,>));
}
示例12: AddComponentsTo
public static void AddComponentsTo(IWindsorContainer container)
{
//Add your components here
container.AddComponent("validator",
typeof(IValidator), typeof(Validator));
container.AddComponent("dbContext", typeof (IDbContext), typeof (DbContext));
AddBLLsTo(container);
AddRepositoriesTo(container);
}
示例13: GetInstance
public static IWindsorContainer GetInstance()
{
if (container == null)
{
container = new WindsorContainer(new XmlInterpreter("CastleIoc/BasicUsage.xml"));
container.AddComponent("txtLog", typeof(ILog), typeof(TextFileLog));
container.AddComponent("txtFormat", typeof(ILogFormatter), typeof(TextFormat));
}
return container;
}
示例14: Init
public void Init()
{
container = new WindsorContainer(new XmlInterpreter(new ConfigResource()));
container.AddFacility("transactionfacility", new TransactionFacility() );
container.AddFacility("arfacility", new ActiveRecordFacility() );
container.AddComponent( "blog.service", typeof(BlogService) );
container.AddComponent( "post.service", typeof(PostService) );
container.AddComponent( "first.service", typeof(FirstService) );
container.AddComponent( "wiring.service", typeof(WiringSession) );
Recreate();
}
示例15: AddGenericRepositoriesTo
private static void AddGenericRepositoriesTo(IWindsorContainer container)
{
container.AddComponent(
"sessionFactoryKeyProvider", typeof(ISessionFactoryKeyProvider), typeof(DefaultSessionFactoryKeyProvider));
container.AddComponent("repositoryType", typeof(IRepository<>), typeof(NHibernateRepository<>));
container.AddComponent(
"nhibernateRepositoryType", typeof(INHibernateRepository<>), typeof(NHibernateRepository<>));
container.AddComponent(
"repositoryWithTypedId", typeof(IRepositoryWithTypedId<,>), typeof(NHibernateRepositoryWithTypedId<,>));
container.AddComponent(
"nhibernateRepositoryWithTypedId",
typeof(INHibernateRepositoryWithTypedId<,>),
typeof(NHibernateRepositoryWithTypedId<,>));
}