本文整理汇总了C#中Castle.Resolve方法的典型用法代码示例。如果您正苦于以下问题:C# Castle.Resolve方法的具体用法?C# Castle.Resolve怎么用?C# Castle.Resolve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Castle
的用法示例。
在下文中一共展示了Castle.Resolve方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Install
/// <summary>
/// Performs the installation in the <see cref="T:Castle.Windsor.IWindsorContainer"/>.
/// </summary>
/// <param name="container">The container.</param>
/// <param name="store">The configuration store.</param>
public void Install( Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store )
{
var conventions = container.Resolve<BootstrapConventions>();
var currentDirectory = Helpers.EnvironmentHelper.GetCurrentDirectory();
container.Register
(
AllTypes.FromAssemblyInDirectory( new AssemblyFilter( currentDirectory ).FilterByAssembly( conventions.IncludeAssemblyInContainerScan ) )
.IncludeNonPublicTypes()
.Where( t => conventions.IsViewModel( t ) && !conventions.IsExcluded( t ) )
.WithService.Select( ( type, baseTypes ) => conventions.SelectViewModelContracts( type ) )
.Configure( r =>
{
r.PropertiesIgnore( conventions.IgnoreViewModelPropertyInjection );
var services = this.GetServices( r );
if ( conventions.IsShellViewModel( services, r.Implementation) )
{
r.LifeStyle.Is( LifestyleType.Singleton );
}
else
{
r.LifeStyle.Is( LifestyleType.Transient );
}
} )
);
container.Register
(
AllTypes.FromAssemblyInDirectory( new AssemblyFilter( currentDirectory ).FilterByAssembly( conventions.IncludeAssemblyInContainerScan ) )
.IncludeNonPublicTypes()
.Where( t => conventions.IsView( t ) && !conventions.IsExcluded( t ) )
.WithService.Select( ( type, baseTypes ) => conventions.SelectViewContracts( type ) )
.Configure( r =>
{
r.PropertiesIgnore( conventions.IgnoreViewPropertyInjection );
var services = this.GetServices( r );
if ( conventions.IsShellView( services, r.Implementation ) )
{
r.LifeStyle.Is( LifestyleType.Singleton );
}
else
{
r.LifeStyle.Is( LifestyleType.Transient );
}
} )
);
}
开发者ID:micdenny,项目名称:Radical.Windows.Presentation.CastleWindsor,代码行数:57,代码来源:PresentationInstaller.cs
示例2: Install
public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
{
container.AddFacility<AutoTxFacility>();
container.Register(Component.For<INHibernateInstaller>().ImplementedBy<NHibernateInstaller>());//.LifeStyle.Singleton);
var ni = container.Resolve<INHibernateInstaller>();
var t = container.ResolveAll<IInterceptor>();
//container.AddFacility<NHibernateFacility>();
container.AddFacility<NHibernateFacility>(f => f.DefaultLifeStyle = DefaultSessionLifeStyleOption.SessionPerWebRequest);
container.Install(FromAssembly.Containing<PersonRepository>());
}
示例3: Install
public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
{
container.Register(
Component
.For<PdfDecrypt>(),
Component
.For<CreateImageFromPdfTask>()
.ImplementedBy<CreateImageFromPdfTask>()
.LifestyleTransient(),
Component
.For<Func<CreateImageFromPdfTask>>()
.Instance(() => container.Resolve<CreateImageFromPdfTask>())
);
//var check = container.Resolve<CreateImageFromPdfTask>();
}
示例4: Install
public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
{
container.Register(
AllTypes
.FromThisAssembly()
.BasedOn<IController>()
.Configure(c => c.LifeStyle.Transient
.Named(c.Implementation.Name)),
Component.For<IPlugin>().ImplementedBy<CurriculumManagementPlugin>().LifeStyle.Is(Castle.Core.LifestyleType.Singleton),
Component.For<ICurriculumStorage>().ImplementedBy<MixedCurriculumStorage>().LifeStyle.Is(Castle.Core.LifestyleType.Singleton),
Component.For<ICurriculumService>().ImplementedBy<CurriculumService>().LifeStyle.Is(Castle.Core.LifestyleType.Singleton)
);
curriculumStorage = container.Resolve<ICurriculumStorage>();
}
示例5: Install
/// <summary>
/// Performs the installation in the <see cref="T:Castle.Windsor.IWindsorContainer"/>.
/// </summary>
/// <param name="container">The container.</param>
/// <param name="store">The configuration store.</param>
public void Install( Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store )
{
var conventions = container.Resolve<BootstrapConventions>();
var currentDirectory = Helpers.EnvironmentHelper.GetCurrentDirectory();
// Registriamo gli handler
container.Register
(
AllTypes.FromAssemblyInDirectory( new AssemblyFilter( currentDirectory ).FilterByAssembly( conventions.IncludeAssemblyInContainerScan ) )
.IncludeNonPublicTypes()
.Where( t => conventions.IsMessageHandler( t ) && !conventions.IsExcluded( t ) )
.WithService.Select( ( type, baseTypes ) => conventions.SelectMessageHandlerContracts( type ) )
.Configure( c => c.PropertiesIgnore( conventions.IgnorePropertyInjection ) )
);
}
开发者ID:micdenny,项目名称:Radical.Windows.Presentation.CastleWindsor,代码行数:20,代码来源:MessageBrokerInstaller.cs
示例6: Install
/// <summary>
/// Performs the installation in the <see cref="T:Castle.Windsor.IWindsorContainer"/>.
/// </summary>
/// <param name="container">The container.</param>
/// <param name="store">The configuration store.</param>
public void Install( Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store )
{
var conventions = container.Resolve<BootstrapConventions>();
container.Register
(
Component.For<TraceSource>()
.UsingFactoryMethod( () =>
{
var name = ConfigurationManager
.AppSettings[ "radical/windows/presentation/diagnostics/applicationTraceSourceName" ]
.Return( s => s, "default" );
return new TraceSource( name );
} )
.LifeStyle.Is( LifestyleType.Singleton )
.PropertiesIgnore( conventions.IgnorePropertyInjection )
);
container.Register(
Component.For<Application>()
.UsingFactoryMethod( () => Application.Current )
.LifeStyle.Is( LifestyleType.Singleton )
.PropertiesIgnore( conventions.IgnorePropertyInjection ),
Component.For<Dispatcher>()
.UsingFactoryMethod( () => Application.Current.Dispatcher )
.LifeStyle.Is( LifestyleType.Singleton )
.PropertiesIgnore( conventions.IgnorePropertyInjection )
);
container.Register(
Component.For<IDispatcher>()
.ImplementedBy<WpfDispatcher>()
.LifeStyle.Is( LifestyleType.Singleton )
.Overridable(),
Component.For<IMessageBroker>()
.ImplementedBy<MessageBroker>()
.LifeStyle.Is( LifestyleType.Singleton )
.Overridable()
.PropertiesIgnore( conventions.IgnorePropertyInjection )
);
}
示例7: Install
public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
{
container.Register(
Component.For<IDataContext>().ImplementedBy<DataContext>()
.DependsOn(Dependency.OnAppSettingsValue("connectionString", "Highway.ConnectionString"))
.LifeStyle.Transient,
Component.For<IRepository>().ImplementedBy<Repository>()
.LifeStyle.Transient,
Component.For<IMappingConfiguration>().ImplementedBy<HighwayMappings>(),
Component.For<ILog>().UsingFactoryMethod((k, c) => LogManager.GetLogger("Highway")),
Component.For<IContextConfiguration>().ImplementedBy<DefaultContextConfiguration>(),
Component.For<IRepositoryFactory>().AsFactory().LifestyleTransient(),
Component.For<IDatabaseInitializer<DataContext>>()
.ImplementedBy<DropCreateDatabaseIfModelChanges<DataContext>>()
.DependsOn(Dependency.OnAppSettingsValue("connectionString", "Highway.ConnectionString"))
);
Database.SetInitializer(container.Resolve<IDatabaseInitializer<DataContext>>());
}
示例8: Install
/// <summary>
/// Performs the installation in the <see cref="T:Castle.Windsor.IWindsorContainer"/>.
/// </summary>
/// <param name="container">The container.</param>
/// <param name="store">The configuration store.</param>
public void Install( Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store )
{
var conventions = container.Resolve<BootstrapConventions>();
container.Register(
Component.For<IRegionManagerFactory>()
.ImplementedBy<RegionManagerFactory>()
.Overridable()
.PropertiesIgnore( conventions.IgnorePropertyInjection ),
Component.For<IRegionService>()
.ImplementedBy<RegionService>()
.Overridable()
.PropertiesIgnore( conventions.IgnorePropertyInjection ),
Component.For<IRegionManager>()
.ImplementedBy<RegionManager>()
.LifeStyle.Is( LifestyleType.Transient )
.Overridable()
.PropertiesIgnore( conventions.IgnorePropertyInjection )
);
}
开发者ID:micdenny,项目名称:Radical.Windows.Presentation.CastleWindsor,代码行数:27,代码来源:UICompositionInstaller.cs