本文整理汇总了C#中IWindsorContainer.Release方法的典型用法代码示例。如果您正苦于以下问题:C# IWindsorContainer.Release方法的具体用法?C# IWindsorContainer.Release怎么用?C# IWindsorContainer.Release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IWindsorContainer
的用法示例。
在下文中一共展示了IWindsorContainer.Release方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateBus
private static Bus CreateBus(IWindsorContainer container, ITypeProvider typeProvider)
{
var configRetriever = container.Resolve<IGetEnvironmentConfiguration>();
try
{
// Get the Azure Service Bus connection string, app name, and unique name for this running instance
string connectionString = configRetriever.GetSetting(AzureServiceBusConnectionStringKey);
string appName = configRetriever.AppName;
string uniqueName = configRetriever.UniqueInstanceId;
Bus bus = new BusBuilder().Configure()
.WithConnectionString(connectionString)
.WithNames(appName, uniqueName)
.WithJsonSerializer()
.WithWindsorDefaults(container)
.WithTypesFrom(typeProvider)
.Build();
bus.Start();
return bus;
}
finally
{
container.Release(configRetriever);
}
}
示例2: RegisterPackages
public void RegisterPackages(IWindsorContainer container, ICollection<RouteBase> routes, ICollection<IViewEngine> engines)
{
var manager = container.Resolve<IWebPackageManager>();
manager.LocatePackages();
manager.RegisterPackages(routes, engines);
container.Release(manager);
}
示例3: AddConfigurationFromContainer
public static void AddConfigurationFromContainer(IWindsorContainer container)
{
var genericMappers = container.ResolveAll<IGenericMapperMarker>();
foreach (var mapperImplementation in genericMappers)
{
if (Mapper.FindTypeMapFor(mapperImplementation.GetSourceType(), mapperImplementation.GetDestinationType()) == null)
{
Mapper.CreateMap(mapperImplementation.GetSourceType(), mapperImplementation.GetDestinationType());
}
}
container.Release(genericMappers);
}
示例4: CreatePrintContext
public static PrintContext CreatePrintContext(
this RecordDataKeeper dataSubject, IWindsorContainer container) {
var f = container.Resolve<PrintContextFactory>();
try {
return f.Create(
dataSubject.GetCalledMethods().First(),
s => new SimpleNameEnumerator(s),
new PrintFormattingImpl(),
new PrintNamingImpl());
}
finally {
container.Release(f);
}
}
示例5: StressTest
public void StressTest()
{
container = new WindsorContainer(TestHelper.GetConfigDir()+"WindsorContainerTest.xml");
IProcessDefinitionService definitionSession = null;
for (int i=1;i<20;i++)
{
definitionSession = (IProcessDefinitionService) container["DefinitionSession"];
Assert.IsNotNull(definitionSession);
definitionSession = (IProcessDefinitionService) container[typeof (IProcessDefinitionService)];
Assert.IsNotNull(definitionSession);
container.Release(definitionSession);
definitionSession=null;
}
}
示例6: RegisterRoutes
protected void RegisterRoutes(RouteCollection routes, ref IWindsorContainer Container)
{
var plugins = Container.ResolveAll<IPlugin>();
foreach (var plugin in plugins)
{
plugin.RegisterRoutes(routes);
}
Container.Release(plugins);
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("{resource}.ico/{*pathInfo}");
routes.IgnoreRoute("Scripts/");
routes.IgnoreRoute("Content/");
routes.IgnoreRoute("Data/");
routes.MapRoute(
"Default", // Route name,
"{controller}/{action}/{id}", // URL with parameters
new {controller = "Home", action = "Index", id = UrlParameter.Optional} // Parameter defaults
);
}
示例7: ExecuteCompositionRoot
static void ExecuteCompositionRoot(string[] args, IWindsorContainer container)
{
_logger.Info("IoC successflly configured");
var execContext = container.Resolve<IExecutionContext>();
execContext.StartReading(); //starting keyboard control
_logger.Info("Execution context started");
var server = container.Resolve<IWebServer>();
try
{
//CreateTestData(container);
server.Start();
Console.WriteLine("Press a key>");
Console.ReadLine();
server.Stop();
}
finally
{
_logger.Info("Final releasing");
container.Release(server);
execContext.CancelSource.Cancel();
container.Release(execContext);
}
}
示例8: WithSession
private static void WithSession(
IWindsorContainer container, Action<IDocumentSession> action)
{
using (container.BeginScope())
{
var session = container.Resolve<IDocumentSession>();
action.Invoke(session);
session.SaveChanges();
container.Release(session);
}
}
示例9: WithEventStore
private static void WithEventStore(IWindsorContainer container, Action<IDocumentSession, IEventStoreSession> action)
{
using (container.BeginScope())
{
var store = container.Resolve<IDocumentStore>();
var session = container.Resolve<IDocumentSession>();
var eventStore = container.Resolve<EventStore>();
var eventStoreSession = eventStore.OpenSession(store, session);
action.Invoke(session, eventStoreSession);
eventStoreSession.SaveChanges();
container.Release(session);
}
}
示例10: RegisterPackages
void RegisterPackages(IWindsorContainer container, ICollection<RouteBase> routes, ICollection<IViewEngine> engines)
{
LocatePackages(container);
var remainingPackages = container.Kernel.GetHandlers(typeof(IWebPackage));
while (remainingPackages.Any())
{
var validPackages = remainingPackages
.Where(handler => handler.CurrentState == HandlerState.Valid)
.ToArray();
if (!validPackages.Any())
{
break;
}
foreach (var handler in validPackages)
{
var package = container.Resolve<IWebPackage>(handler.ComponentModel.Name);
package.Register(container, routes, engines);
container.Release(package);
}
remainingPackages = remainingPackages.Except(validPackages).ToArray();
}
if (!remainingPackages.Any())
{
return;
}
var message =
String.Format(
"Web packages have unresolved dependencies. The following packages could not be installed: {0}",
String.Join(", ", remainingPackages.Select(x => x.ComponentModel.Implementation)));
throw new ApplicationException(message);
}