Topshelf A cache implementation that extends the capability of most dictionary style classes to have a more complete set of methods commonly used in a dictionary scenario. The key type of the cache The value type of the cache Sets the missing value provider used by the cache to create requested values that do not exist in the cache Sets the callback that is called when a new value is added to the cache Sets the callback that is called when a value is removed or replaced from the cache Sets the callback that is called when a duplicate value is added to the cache Specifies a selector that returns the key from a value which is used when a value is added to the cache References a value in the cache, returning a newly created or existing value for the specified key, and adding a new or replacing an existing value in the cache The key references the value The value from the cache Get the value for the specified key The key referencing the value in the cache The matching value if the key exists in the cache, otherwise an exception is thrown Get the value for the specified key, overriding the default missing value provider The key referencing the value in the cache An overloaded missing value provider to create the value if it is not found in the cache The matching value if the key exists in the cache, otherwise an exception is thrown Get a value for the specified key, if not found returns the specified default value The key referencing the value in the cache The default value to return if the key is not found in the cache The matching value if it exists in the cache, otherwise the default value Get a value for the specified key, if not found returns the specified default value The key referencing the value in the cache The default value to return if the key is not found in the cache The matching value if it exists in the cache, otherwise the default value Gets a value for the specified key if it exists The key referencing the value in the cache The value if it exists in the cache, otherwise the default value True if the item was in the cache, otherwise false Adds a value to the cache using the specified key. If the key already exists in the cache, an exception is thrown. The key referencing the value The value Adds a value to the cache using the KeySelector to extract the key from the value. If the key already exists in the cache, an exception is thrown. The value Remove an existing value from the cache The key referencing the value Remove an existing value from the cache, using the KeySelector to extract the key to find the value The value to remove Removes all items from the cache Fills the cache from a list of values, using the KeySelector to extract the key for each value. Calls the callback with the value matching the specified key The key referencing the value The callback to call True if the value exists and the callback was called Calls the function with the value matching the specified key, returning the result of that function The result type of the function The key references the value The function to call The default return value if the item does not exist in the cache The return value of the function, or the defaultValue specified if the item does not exist in the cache Calls the function with the value matching the specified key, returning the result of that function The result type of the function The key references the value The function to call The default return value if the item does not exist in the cache The return value of the function, or the defaultValue specified if the item does not exist in the cache Constructs a cache for the specified generic type The generic type to close Constructs a cache for the specified generic type. The generic type to close The implementation provider, which must close the generic type with the passed type A read-only view of a cache. Methods that are able to modify the cache contents are not available in this reduced interface. Methods on this interface will NOT invoke a missing item provider. The number of items in the cache Checks if the key exists in the cache The key to check True if the key exists, otherwise false Checks if a value exists in the cache The value to check True if the value exists, otherwise false Calls the specified callback with each value in the cache A callback that accepts the value for each item in the cache Calls the specified callback with each item in the cache A callback that accepts the key and value for each item in the cache Uses a predicate to scan the cache for a matching value The predicate to run against each value True if a matching value exists, otherwise false Uses a predicate to scan the cache for a matching value The predicate to run against each value The matching value True if a matching value was found, otherwise false Gets all keys that are stored in the cache An array of every key in the dictionary Gets all values that are stored in the cache An array of every value in the dictionary Using the service configuration, the host builder will create the host that will be ran by the service console. Tools for parsing the command line Gets the command line from the Environment.CommandLine, removing the application name if present The complete, unparsed command line that was specified when the program was executed Parses the command line The command line to parse The command line elements that were found Parses the command line and matches any specified patterns The output type of the parser The command line text Used by the caller to add patterns and object generators The elements that were found on the command line Used to configure the command line element parser The type of object returned as a result of the parse Adds a new pattern to the parser The pattern to match and return the resulting object Reports information about the configuration before configuring so that corrections can be made without allocating resources, etc. The disposition of the result, any Failure items will prevent the configuration from completing. The message associated with the result The key associated with the result (chained if configurators are nested) The value associated with the result A selection of commonly-used Windows services. The Microsoft Message Queue service. The Microsoft SQL Server service. The Internet Information Server service. The Event Log service. Sets additional text to be displayed before the built-in help text is displayed Specifies a text resource to be loaded and displayed before the built-in system help text is displayed The assembly containing the text resource The name of the embedded resource Adds a dependency to the InstallBuilder (ignored otherwise) Can configure/replace the input , returning the original or a new . Configures the host builder. The host builder. The configured host builder. Specifies the name of the service as it should be displayed in the service control manager Specifies the name of the service as it is registered in the service control manager Specifies the description of the service that is displayed in the service control manager Specifies the service instance name that should be used when the service is registered Sets the amount of time to wait for the service to start before timing out. Default is 10 seconds. Sets the amount of time to wait for the service to stop before timing out. Default is 10 seconds. Enable pause and continue support for the service (default is disabled) Enable support for service shutdown (signaled by the host OS) Enables support for the session changed event Enables support for power events (signaled by the host OS) Enables support for gracefully handling Ctrl+Break signals Specifies the builder factory to use when the service is invoked Sets the service builder to use for creating the service Sets the environment builder to use for creating the service (defaults to Windows) Adds a a configurator for the host builder to the configurator Parses the command line options and applies them to the host configurator Parses the command line options from the specified command line and applies them to the host configurator Adds a command line switch (--name) that can be either true or false. Switches are CASE SeNsITiVe The name of the switch, as it will appear on the command line Adds a command line definition (-name:value) that can be specified. the name is case sensitive. If the definition Specifies a callback to be run when Topshelf encounters an exception while starting, running or stopping. This callback does not replace Topshelf's default handling of any exceptions, and is intended to allow for local cleanup, logging, etc. This is not required, and is only invoked if a callback is provided. The action to run when an exception occurs. The policy that will be used when Topself detects an UnhandledException in the application. The default policy is to log an error and to stop the service. Implements a service recovery configurator and host builder configurator. Configures the host builder. The host builder. The configured host builder. builder Adds a restart service recovery action with the specified delay. The delay. The service recovery configurator. Adds a restart service recovery action with the specified delay in minutes. The delay in minutes. The service recovery configurator. Adds a restart computer recovery action with the specified delay. The delay. The message. ServiceRecoveryConfigurator. Adds a restart computer recovery action with the specified delay in minutes. The delay in minutes. The message. The service recovery configurator. Adds a run program recovery action with the specified delay. The delay. The command to run. The service recovery configurator. Adds a run program recovery action with the specified delay in minutes. The delay in minutes. The command. The service recovery configurator. Adds a take no action recovery action. The service recovery configurator. Sets the recovery reset period in days. The reset period in days. Specifies that the recovery actions should only be taken on a service crash. If the service exits with a non-zero exit code, it will not be restarted. Represents an option to set a service dependency. The dependency name Initializes a new instance of the class. Name of the dependency. Applies the option to the specified host configurator. The host configurator. Represents an option to set a service recovery options. Initializes a new instance of the class. The service recovery options. Applies the option to the specified host configurator. The host configurator. Represents an option to set a service start timeout (in seconds). The start timeout (in seconds). Initializes a new instance of the class. The start timeout (in seconds). Applies the option to the specified host configurator. The host configurator. Represents an option to set a service stop timeout (in seconds). The stop timeout (in seconds). Initializes a new instance of the class. The stop timeout (in seconds). Applies the option to the specified host configurator. The host configurator. Registers a callback invoked before the service Start method is called. Registers a callback invoked after the service Start method is called. Registers a callback invoked before the service Stop method is called. Registers a callback invoked after the service Stop method is called. Registers a callback invoked before the service Start method is called. Registers a callback invoked after the service Start method is called. Registers a callback invoked before the service Stop method is called. Registers a callback invoked after the service Stop method is called. Defines a service recovery configurator. Restart the service after waiting the delay period specified The delay. The service recovery configurator. Restart the service after waiting the delay period in minutes The delay in minutes. The service recovery configurator. Restart the computer after waiting the delay period specified The delay. The service recovery configurator. Restart the computer after waiting the delay period in minutes The delay in minutes. The service recovery configurator. Run the command specified The delay. The command to run. The service recovery configurator. Run the command specified The delay in minutes. The command to run. The service recovery configurator. Take no action The service recovery configurator. Specifies the reset period for the restart options The reset period in days. Specifies that the recovery actions should only be taken on a service crash. If the service exits with a non-zero exit code, it will not be restarted. Configures the test host, which simply starts and stops the service. Meant to be used to verify the service can be created, started, stopped, and disposed without issues. A Host can be a number of configured service hosts, from installers to service runners Runs the configured host Allows the service to control the host while running Tells the Host that the service is still starting, which resets the timeout. Stops the Host Stops the Host, returning the specified exit code Configure and run a service host using the HostFactory Configures a new service host Configuration method to call A Topshelf service host, ready to run Configures and runs a new service host, handling any exceptions and writing them to the log. Configuration method to call Returns the exit code of the process that should be returned by your application's main method If called, prevents the service from starting Displays the Topshelf command line reference True if the service handles power change events Implementers handle logging and filtering based on logging levels. Delegate to provide the log output if the log level is enabled Logs a debug message. The message to log Logs a debug message. The exception to log The message to log Logs a debug message. Format string for the message to log Format arguments for the message to log Logs a debug message. The format provider to use Format string for the message to log Format arguments for the message to log Logs an info message. The message to log Logs an info message. The exception to log The message to log Logs an info message. Format string for the message to log Format arguments for the message to log Logs an info message. The format provider to use Format string for the message to log Format arguments for the message to log Logs a warn message. The message to log Logs a warn message. The exception to log The message to log Logs a warn message. Format string for the message to log Format arguments for the message to log Logs a warn message. The format provider to use Format string for the message to log Format arguments for the message to log Logs an error message. The message to log Logs an error message. The exception to log The message to log Logs an error message. Format string for the message to log Format arguments for the message to log Logs an error message. The format provider to use Format string for the message to log Format arguments for the message to log Logs a fatal message. The message to log Logs a fatal message. The exception to log The message to log Logs a fatal message. Format string for the message to log Format arguments for the message to log Logs a fatal message. The format provider to use Format string for the message to log Format arguments for the message to log Logs a debug message. The exception to log Format string for the message to log Format arguments for the message to log Logs a debug message. The exception to log The format provider to use Format string for the message to log Format arguments for the message to log Logs an info message. The exception to log Format string for the message to log Format arguments for the message to log Logs an info message. The exception to log The format provider to use Format string for the message to log Format arguments for the message to log Logs a warn message. The exception to log Format string for the message to log Format arguments for the message to log Logs a warn message. The exception to log The format provider to use Format string for the message to log Format arguments for the message to log Logs an error message. The exception to log Format string for the message to log Format arguments for the message to log Logs an error message. The exception to log The format provider to use Format string for the message to log Format arguments for the message to log Logs a fatal message. The exception to log Format string for the message to log Format arguments for the message to log Logs a fatal message. The exception to log The format provider to use Format string for the message to log Format arguments for the message to log The system has requested permission to suspend the computer. An application that grants permission should carry out preparations for the suspension before returning. Not supported by The system was denied permission to suspend the computer. This status is broadcast if any application or driver denied a previous status. Not supported by The computer is about to enter a suspended state. This event is typically broadcast when all applications and installable drivers have returned true to a previous QuerySuspend state. The system has resumed operation after a critical suspension caused by a failing battery. Not supported by The system has resumed operation after being suspended. Not supported by Battery power is low. Not supported by A change in the power status of the computer is detected, such as a switch from battery power to A/C. The system also broadcasts this event when remaining battery power slips below the threshold specified by the user or if the battery power changes by a specified percentage. An Advanced Power Management (APM) BIOS signaled an APM OEM event. Not supported by The computer has woken up automatically to handle an event. Abstracts the environment in which the host in running (different OS versions, platforms, bitness, etc.) Determines if the service is running as an administrator Determines if the process is running as a service Determines if the service is installed The name of the service as it is registered True if the service is installed, otherwise false Determines if the service is stopped, to prevent a debug instance from being started Start the service using operating system controls The name of the service Waits for the service to reach the running status in the specified time. Stop the service using operating system controls The name of the service Waits for the service to reach the stopeed status in the specified time. Install the service using the settings provided Uninstall the service using the settings provided Restarts the service as an administrator which has permission to modify the service configuration True if the child process was executed, otherwise false Create a service host appropriate for the host environment Send a command to a service to make it do something The service name The command value The settings that have been configured for the operating system service The name of the service The name of the service as it should be displayed in the service control manager The description of the service that is displayed in the service control manager The service instance name that should be used when the service is registered Returns the Windows service name, including the instance name, which is registered with the SCM Example: myservice$bob True if the service supports pause and continue True if the service can handle the shutdown event True if the service handles session change events True if the service handles power change events The amount of time to wait for the service to start before timing out. Default is 10 seconds. The amount of time to wait for the service to stop before timing out. Default is 10 seconds. A callback to provide visibility into exceptions while Topshelf is performing its own handling. The policy that will be used when Topself detects an UnhandledException in the application. The default policy is to log an error and to stop the service. True if the service handles Ctrl+Break gracefully A handle to a service being hosted by the Host Start the service True if the service was started, otherwise false Pause the service True if the service was paused, otherwise false Continue the service from a paused state True if the service was able to continue, otherwise false Stop the service True if the service was stopped, or false if the service cannot be stopped at this time Handle the shutdown event Handle the session change event Handle the power change event Handle the custom command If an UnhandledException occurs, Topshelf will log an error and stop the service If an UnhandledException occurs, Topshelf will log an error and continue without stopping the service If an UnhandledException occurs, Topshelf will take no action. It is assumed that the application will handle the UnhandledException itself. Required to connect to the service control manager. Required to call the CreateService function to create a service object and add it to the database. Required to call the EnumServicesStatusEx function to list the services that are in the database. Required to call the LockServiceDatabase function to acquire a lock on the database. Required to call the QueryServiceLockStatus function to retrieve the lock status information for the database. Required to call the NotifyBootConfigStatus function. Includes STANDARD_RIGHTS_REQUIRED, in addition to all access rights in this table. The action to be performed. This member can be one of the following values from the enumeration type. The time to wait before performing the specified action, in milliseconds. Represents a restart service service recovery action. Initializes a new instance of the class. The delay. Gets the service recovery configuration action. A representing the restart service service recovery configuration action. Represents a restart system service recovery action. Initializes a new instance of the class. The delay. The restart message. Gets the system restart message. The system restart message. Gets the service recovery configuration action. A representing the restart system service recovery configuration action. Represents a run command service recovery action. Initializes a new instance of the class. The delay. The command. Gets the command to run. The command. to run Gets the service recovery configuration action. A representing the run command service recovery configuration action. Represents a service recovery action. Initializes a new instance of the class. The delay. Gets the delay in milliseconds. The delay in milliseconds. Gets the service recovery configuration action. A representing the service recovery configuration action. Represents a take no action recovery action. Initializes a new instance of the class. Gets the service recovery configuration action. A representing the take no action service recovery configuration action. Creates a new WindowsServiceDescription using empty strings for the properties. The class is required to have names by the consumers. Creates a new WindowsServiceDescription instance using the passed parameters. Implemented by services that support custom command events Implemented by services that support power change events Implemented by services that support session change events Implemented by services that support service shutdown Called when the operating system invokes the service shutdown method. There is little time to react here, but the application try to use RequestAdditionalTime if necessary, but this is really a shut down quick and bail method. If implemented by a service, used to pause/continue the service