What are Bootstrappers/Bootstrapping in C#

2019-04-26 14:40发布

问题:

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?

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.

回答1:

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.



回答2:

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.



回答3:

Bootstrap refers to the loop of leather that helps to pull a boot over your foot.

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""

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.



回答4:

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):

public class BootstrapperClass : Module
{
    protected override void Load(ContainerBuilder builder)
    {
        base.Load(builder);
        builder.RegisterType<SomeImplementation>().As<ISomeInterface>();            
    }
}


回答5:

Bootstrap could also refer to the twitter bootstrap framework which can be used with asp.net/c# websites. see http://getbootstrap.com