Skip to content

Commit

Permalink
Added extra arguments to service start method
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterKottas committed Dec 29, 2016
1 parent 8f7be64 commit 5d94b26
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Source/PeterKottas.DotNetCore.Example/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public static void Main(string[] args)
{
return new ExampleServiceTimer();
});
serviceConfig.OnStart(service =>

serviceConfig.OnStart((service, extraParams) =>
{
Console.WriteLine("Service {0} started", name);
service.Start();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using PeterKottas.DotNetCore.WindowsService.Interfaces;
using System;
using System.Collections.Generic;

namespace PeterKottas.DotNetCore.WindowsService.Configurators.Service
{
Expand All @@ -16,7 +17,7 @@ public void ServiceFactory(Func<SERVICE> serviceFactory)
config.ServiceFactory = serviceFactory;
}

public void OnStart(Action<SERVICE> onStart)
public void OnStart(Action<SERVICE, List<string>> onStart)
{
config.OnServiceStart = onStart;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public HostConfiguration()

public Func<SERVICE> ServiceFactory { get; set; }

public Action<SERVICE> OnServiceStart { get; set; }
public Action<SERVICE, List<string>> OnServiceStart { get; set; }

public Action<SERVICE> OnServiceStop { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<metadata>
<id>PeterKottas.DotNetCore.WindowsService</id>
<title>PeterKottas.DotNetCore.WindowsService</title>
<version>1.0.3</version>
<version>1.0.4</version>
<authors>Peter Kottas</authors>
<description>Easiest to use library that allows one to host .net core as windows services there is.</description>
<summary>.NET Core Windows service</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ private static void Start(HostConfiguration<SERVICE> config)
{
try
{
config.OnServiceStart(config.Service);
config.OnServiceStart(config.Service, config.ExtraArguments);
}
catch (Exception e)
{
Expand Down

0 comments on commit 5d94b26

Please sign in to comment.