Exemple #1
0
 /// <summary>
 /// Begins execution of the service and performs the service operations.
 /// </summary>
 /// <exception cref="ServiceExectuionException">
 /// An exception was raised during execution of the service.
 /// </exception>
 public void Execute()
 {
     try
     {
         using (var executionLifetime = new ServiceExecutionLifetime())
         {
             using (var dependencyScope = CreateDependencyScope())
             {
                 Execute(dependencyScope, ApplicationConfiguration, executionLifetime);
             }
         }
     }
     catch (ServiceExectuionException)
     {
         throw;
     }
     catch (Exception exception)
     {
         throw new ServiceExectuionException($"An exception was raised during execution of the service: \"{ServiceName}\". See inner exception for details.", exception);
     }
 }
Exemple #2
0
 /// <summary>
 /// Begins execution of the service and performs the service operations.
 /// </summary>
 /// <param name="dependencyScope">
 /// A scope that is used to resolve service dependencies.
 /// </param>
 /// <param name="applicationConfiguration">
 /// Configuration information for the service application.
 /// </param>
 /// <param name="executionLifetime">
 /// An object that provides control over execution lifetime.
 /// </param>
 protected virtual void Execute(IDependencyScope dependencyScope, IConfiguration applicationConfiguration, ServiceExecutionLifetime executionLifetime)
 {
     return;
 }