什么是 C# 中的引导程序/引导程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18968040/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What are Bootstrappers/Bootstrapping in C#
提问by BenM
I've seen these terms used in a few different places all to mean different things depending on the technology involved. Please could someone explain to me what it means in C# terms and the benefits of using it?
我已经在几个不同的地方看到这些术语都表示不同的东西,具体取决于所涉及的技术。请有人向我解释它在 C# 术语中的含义以及使用它的好处吗?
I am looking for answers specifically related to bootstrapping in C#. I'm looking for how, in terms of C#, bootstrapping relates to other .NET frameworks/components.
我正在寻找与 C# 中的引导特别相关的答案。我正在寻找就 C# 而言,引导如何与其他 .NET 框架/组件相关。
采纳答案by Antarr Byrd
The bootstrapper is responsible for the initialization of an application built using the Composite Application Library. By using a bootstrapper, you have more control of how the Composite Application Library components are wired up to your application. For example, if you have an existing application that you are adding the Composite Application Library to, you can initialize the bootstrapping process after the application is already running.
引导程序负责使用复合应用程序库构建的应用程序的初始化。通过使用引导程序,您可以更好地控制复合应用程序库组件如何连接到您的应用程序。例如,如果您有一个要添加复合应用程序库的现有应用程序,您可以在应用程序已经运行后初始化引导过程。
Read More...at msdn concerning a bootstrapper.
回答by tgolisch
A bootstrap is a program that launches your program. When you need to deploy changes to your program, using a bootstrapper is handy because it is a program that looks for an update, downloads it before launching the program.
引导程序是启动您的程序的程序。当您需要将更改部署到您的程序时,使用引导程序很方便,因为它是一个查找更新的程序,在启动程序之前下载它。
回答by Co-der
Bootstrap refers to the loop of leather that helps to pull a boot over your foot.
Bootstrap 是指帮助将靴子拉到脚上的皮革环。
It's similiar to booting I guess: [Wikipedia] http://en.wikipedia.org/wiki/Bootstrapping#Applications- "Booting is the process of starting a computer, specifically in regards to starting its software. The process involves a chain of stages, in which at each stage a smaller simpler program loads and then executes the larger more complicated program of the next stage. It is in this sense that the computer "pulls itself up by its bootstraps""
我猜这类似于启动:[维基百科] http://en.wikipedia.org/wiki/Bootstrapping#Applications- “启动是启动计算机的过程,特别是在启动其软件方面。该过程涉及一系列阶段,其中在每个阶段加载一个更小的更简单的程序,然后执行下一阶段更大的更复杂的程序。从这个意义上说,计算机“通过它的引导程序将自己拉起来””
The Composite Application Library has an implementation for initialisation but I have seen other proprietary implementations e.g. pulling down applications to compute grid nodes and launching them.
复合应用程序库有一个初始化实现,但我看到了其他专有实现,例如拉下应用程序来计算网格节点并启动它们。
I suppose ClickOnce could also be thought of as a bootstrapper when lanuching applications.
我想 ClickOnce 也可以被认为是启动应用程序时的引导程序。
回答by C1sc0
For example if you using some kind os dependency injection framework in you application and you set up the mappings that must be done before your application could run.
例如,如果您在应用程序中使用某种操作系统依赖注入框架,并且您设置了必须在应用程序运行之前完成的映射。
Example code (Autofac):
示例代码(Autofac):
public class BootstrapperClass : Module
{
protected override void Load(ContainerBuilder builder)
{
base.Load(builder);
builder.RegisterType<SomeImplementation>().As<ISomeInterface>();
}
}