Skip to content

Commit

Permalink
Extra arguments passed to service factory
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterKottas committed Dec 29, 2016
1 parent b6a7e06 commit 7c528b0
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Using nuget:
var name = config.GetDefaultName();
config.Service(serviceConfig =>
{
serviceConfig.ServiceFactory(() =>
serviceConfig.ServiceFactory((extraArguments) =>
{
return new ExampleService();
});
Expand Down
2 changes: 1 addition & 1 deletion Source/PeterKottas.DotNetCore.Example/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static void Main(string[] args)
var name = config.GetDefaultName();
config.Service(serviceConfig =>
{
serviceConfig.ServiceFactory(() =>
serviceConfig.ServiceFactory((extraArguments) =>
{
return new ExampleServiceTimer();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public ServiceConfigurator(HostConfiguration<SERVICE> config)
this.config = config;
}

public void ServiceFactory(Func<SERVICE> serviceFactory)
public void ServiceFactory(Func<List<string>, SERVICE> serviceFactory)
{
config.ServiceFactory = serviceFactory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public HostConfiguration()

public SERVICE Service { get; set; }

public Func<SERVICE> ServiceFactory { get; set; }
public Func<List<string>, SERVICE> ServiceFactory { get; set; }

public Action<SERVICE, List<string>> OnServiceStart { 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.4</version>
<version>1.0.5</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 @@ -123,7 +123,7 @@ public static int Run(Action<HostConfigurator<SERVICE>> runAction)
try
{
runAction(hostConfiguration);
innerConfig.Service = innerConfig.ServiceFactory();
innerConfig.Service = innerConfig.ServiceFactory(innerConfig.ExtraArguments);
ConfigureService(innerConfig);
return 0;
}
Expand Down

0 comments on commit 7c528b0

Please sign in to comment.