Main content
1. Startable Facility Overview
2. Implement Istartable interface using the detailed
3. Do not implement Istartable interface use
A Startable Facility Overview
Before we start using startable facility, let's take a look at what it does, which allows a component to start or stop automatically after it satisfies a dependency. Information on the startable facility provided in the official website:
Facility Information |
Uses Proxy |
No |
Requires Configuration |
No |
Uses Attributes |
No |
Version |
Beta 2 |
Two Implement Istartable interface using the detailed
The use of startable facility can be said to be very simple, as long as our components implement the Istartable interface. Now we also have a program class that specifically controls server startup and stop, and we want the server to start automatically when its dependencies are met. Quite simply, we let the program class implement the Istartable interface:
/**//// <summary>
/// Author:Terrylee
/// Date:2006年4月28日
/// From:
/// </summary>
public class Program : IStartable
{
private Server _server;
public Program(Server server)
{
this._server = server;
}
public void Start()
{
_server.Start();
}
public void Stop()
{
_server.Stop();
}
}