Initialization task bootstrapper

Source: Internet
Author: User

Each applicationProgramYou need to perform initialization tasks at startup and cleanup when you exit. Such tasks are classified as bootstrapper, an open-source project on codeplex. For details, see http://bootstrapper.codeplex.com/to help us complete the next task.

1. When necessary, we can separate the implementation from the interface to implement dependency injection (the project reference is not required, but the DLL under the folder is required ). Then, we need to inject these implementations when the website application or other applications are started. Here, we need to mention that, because we separate the implementation from the interface, we can make the two components reference each other, for example, the implementation of Configuration Service can call the interface of information center to record logs, while the implementation of information center can call the interface of Configuration Service to store configurations.

2. Then, we need to initialize each component, for example, data initialization. This step must be completed after 1.

Of course, there can also be 3, 4, and 5, which are called bootstrappertask. When an application is started, as long as the Assembly contains bootstrappertask, bootstrapper will automatically find these tasks and call them in parallel by group by order. At the end of the application, bootstrapper will also call all dispose in sequence to clean up the tasks.

Use bootstrapper to initialize differentCodeIt is organized into different tasks (implementing the istartuptask Interface), and then these tasks are called through the fluent API of Bootstrap. bootstrapper, And the execution sequence of the tasks can be specified.

Loneliness is so beautiful: Discontinuing from application_start, making initialization code more elegant

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.