本文整理匯總了C#中Bootstrapper類的典型用法代碼示例。如果您正苦於以下問題:C# Bootstrapper類的具體用法?C# Bootstrapper怎麽用?C# Bootstrapper使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Bootstrapper類屬於命名空間,在下文中一共展示了Bootstrapper類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: OnStartup
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
Bootstrapper bootstrapper = new Bootstrapper();
bootstrapper.Run();
}
示例2: App
static App()
{
DispatcherHelper.Initialize();
//AppDomain domain = AppDomain.CurrentDomain;
//domain.SetupInformation.PrivateBinPath = @"\\Plugins";
//AppDomainSetup domain = new AppDomainSetup();
//domain.PrivateBinPath = @"Plugins";
//FIXME: AppendPrivatePath is deprecated.
string pluginsFolder = @".\Plugins\";
string pluginsFolderFullPath = Path.GetFullPath(pluginsFolder);
if (!Directory.Exists(pluginsFolderFullPath))
Directory.CreateDirectory(pluginsFolderFullPath);
AppDomain.CurrentDomain.AppendPrivatePath(pluginsFolderFullPath);
string[] pluginSubdirectories = Directory.GetDirectories(pluginsFolderFullPath);
foreach (string pluginSubdirectory in pluginSubdirectories)
{
AppDomain.CurrentDomain.AppendPrivatePath(pluginSubdirectory);
}
Bootstrapper bootstrapper = new Bootstrapper();
}
示例3: ApplicationStartup
protected override void ApplicationStartup(IUnityContainer container, Bootstrapper.IPipelines pipelines)
{
RequestContainerConfigured = true;
container.RegisterType<IFoo, Foo>(new ContainerControlledLifetimeManager());
container.RegisterType<IDependency, Dependency>(new ContainerControlledLifetimeManager());
}
示例4: TestBase
public TestBase()
{
var bootstrapper = new Bootstrapper();
host = new NancyHost(bootstrapper, new Uri(path));
host.Start();
Console.WriteLine("*** Host listening on " + path);
}
示例5: Configuration
public void Configuration(IAppBuilder app)
{
//log4net.Config.XmlConfigurator.Configure();
var bootstrapper = new Bootstrapper();
var container = bootstrapper.Build();
var priceFeed = container.Resolve<IPriceFeed>();
priceFeed.Start();
var cleaner = container.Resolve<Cleaner>();
cleaner.Start();
app.UseCors(CorsOptions.AllowAll);
app.Map("/signalr", map =>
{
var hubConfiguration = new HubConfiguration
{
// you don't want to use that in prod, just when debugging
EnableDetailedErrors = true,
EnableJSONP = true,
Resolver = new AutofacSignalRDependencyResolver(container)
};
map.UseCors(CorsOptions.AllowAll)
.RunSignalR(hubConfiguration);
});
}
示例6: GetImporterPlugins
public static IEnumerable<ICmsImporterPlugin> GetImporterPlugins()
{
IEnumerable<ICmsImporterPlugin> plugins = new BindingList<ICmsImporterPlugin>();
try
{
var bootStrapper = new Bootstrapper();
//An aggregate catalog that combines multiple catalogs
var catalog = new AggregateCatalog();
//Adds all the parts found in same directory where the application is running!
var currentPath = HostingEnvironment.ApplicationPhysicalPath;
currentPath = String.Format("{0}Bin\\PlugIns", currentPath);
catalog.Catalogs.Add(new DirectoryCatalog(currentPath));
//Create the CompositionContainer with the parts in the catalog
var container = new CompositionContainer(catalog);
//Fill the imports of this object
container.ComposeParts(bootStrapper);
plugins = bootStrapper.ImporterPlugins;
}
catch (CompositionException compositionException)
{
log.Error("", compositionException, compositionException.Message);
}
catch (Exception ex)
{
log.Error("", ex, ex.Message);
}
return plugins;
}
示例7: Main
private static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
var bootstrapper = new Bootstrapper<MainViewModel>(new AutofacContainer());
bootstrapper.Start();
}
示例8: OnStartup
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
try
{
string fileName;
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
ApplicationService.Closing += new System.ComponentModel.CancelEventHandler(ApplicationService_Closing);
ThemeHelper.LoadThemeFromRegister();
#if DEBUG
bool trace = false;
BindingErrorListener.Listen(m => { if (trace) MessageBox.Show(m); });
#endif
_bootstrapper = new Bootstrapper();
using (new DoubleLaunchLocker(SignalId, WaitId))
_bootstrapper.Initialize();
if (Application.Current != null && e.Args != null && e.Args.Length > 0)
{
fileName = e.Args[0];
FileConfigurationHelper.LoadFromFile(fileName);
}
}
finally
{
ServiceFactory.StartupService.Close();
}
}
示例9: Main
static void Main()
{
var container = new Bootstrapper()
.RegisterComponents()
.Container;
using (var uow = container.Resolve<IUnitOfWork>())
{
var query = new GetAddressByCity("Bothell");
var address = uow.ExecuteQuery(query);
Console.WriteLine("AdventureWorks DB: PLZ von Bothell: {0}", address.PostalCode);
}
using (var uow = container.Resolve<IUnitOfWork>())
{
var employee = uow.Entities<Employee>().First();
Console.WriteLine("Northwind DB: Name des ersten Eintrags {0} {1}", employee.FirstName, employee.LastName);
}
using (var uow = container.Resolve<IUnitOfWork>())
{
var sqlFunction = new GetProductListPrice(707, new DateTime(2008, 1, 1));
var productListPrice = uow.ExecuteFunction(sqlFunction);
Console.WriteLine("Aufruf der SQL Funktion GetProductListPrice ergibt den Wert: {0}", productListPrice);
}
Console.ReadLine();
}
示例10: OnStartup
/// <summary>
/// Raises the <see cref="E:System.Windows.Application.Startup" /> event.
/// </summary>
/// <param name="e">A <see cref="T:System.Windows.StartupEventArgs" /> that contains the event data.</param>
protected override void OnStartup(System.Windows.StartupEventArgs e)
{
var bootstrapper = new Bootstrapper();
bootstrapper.RunWithSplashScreen<ProgressNotifyableViewModel>();
base.OnStartup(e);
}
示例11: OnStartup
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
var bstrap = new Bootstrapper();
bstrap.Run();
}
示例12: OnStartup
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
var bootstrapper = new Bootstrapper();
var shellView = bootstrapper.Bootstrap();
var bus = bootstrapper.Resolve<IMessageBus>();
bus.RegisterMessageSource(this.GetActivated().Select(_ => new ApplicationActivatedMessage()));
bus.RegisterMessageSource(this.GetDeactivated().Select(_ => new ApplicationDeactivatedMessage()));
shellView.Window.Show();
MainWindow = shellView.Window;
ShutdownMode = ShutdownMode.OnMainWindowClose;
var toastWindow = bootstrapper.Resolve<IToastWindow>();
toastWindow.Window.Show();
//int i = 1;
//bus.RegisterMessageSource(Observable.Interval(TimeSpan.FromSeconds(3)).Select(_ => i++)
// .Take(100).Select(num => new ShowToastMessage(
// new NotificationMessage(
// new Room { Name = "Ohai " + num },
// new User { Name = "Arild" },
// new Message { Body = "Ohai thar " + num, MessageTypeString = MessageType.TextMessage.ToString() }),
// new ShowToastNotificationAction())));
}
示例13: OnStartup
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
if (e.Args.Any(item => string.Equals(item, "Integrate", StringComparison.InvariantCultureIgnoreCase)))
{
RegistryHelper.Integrate();
Environment.Exit(1);
}
if (e.Args.Any(item => string.Equals(item, "Desintegrate", StringComparison.InvariantCultureIgnoreCase)))
{
RegistryHelper.Desintegrate();
Environment.Exit(1);
}
#if DEBUG
BindingErrorListener.Listen(m => MessageBox.Show(m));
#endif
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
ApplicationService.Closing += new System.ComponentModel.CancelEventHandler(ApplicationService_Closing);
_bootstrapper = new Bootstrapper();
using (new DoubleLaunchLocker(SignalId, WaitId))
_bootstrapper.Initialize();
}
示例14: Startup
public Startup(IObjectContainer objectContainer)
{
var containerAdapter = new ObjectContainerAdapter(objectContainer);
var bootstrapper =
new Bootstrapper(containerAdapter)
.Use(new RegisterCompositionModulesMiddleware<Bootstrapper>());
bootstrapper.Initialize();
}
示例15: ExpectAsyncNamedRouteIsResolvedCorrectlyByService
public void ExpectAsyncNamedRouteIsResolvedCorrectlyByService(RouteRegistrar registrar, Guid token)
{
using (var bootstrapper = new Bootstrapper())
{
var browser = new Browser(bootstrapper);
browser.Get<NamedRouteResponse>("/named/async/" + token).Uri.Should().Be("/some-named-async-route/" + token);
}
}