You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.
When we fork a repo and build a service on top of it, currently it is hard to sync back any updates done to this repo. And if we have build multiple services then we need to go and make changes to all corresponding services.
Expected Behavior
All the common code can be extracted to a separate library so that our Program.cs remains neat and clean. When we build multiple micro services in client environment we can just reference the common library and it will be easy to sync any changes from the main github repo as we will need to make changes at just one place.
We can extract all the common logic written in Program.cs and CommandLine.cs to a separate class library e.g Helium.Core and reference that in our web api project.
Here is how the Program.cs will look like after refactoring:
public class Program
{
public static async Task<int> Main(string[] args)
{
var host = CreateHostBuilder();
// build the System.CommandLine.RootCommand
RootCommand root = CommandLineHelper.BuildRootCommand();
root.Handler = CommandHandler.Create<string, AuthenticationType, LogLevel, bool>(CommandLineHelper.RunApp);
// run the app
return await root.InvokeAsync(CommandLineHelper.CombineEnvVarsWithCommandLine(args,host)).ConfigureAwait(false);
}
public static IWebHostBuilder CreateHostBuilder() =>
WebHost.CreateDefaultBuilder().UseStartup<Startup>();
}
The text was updated successfully, but these errors were encountered:
Description
When we fork a repo and build a service on top of it, currently it is hard to sync back any updates done to this repo. And if we have build multiple services then we need to go and make changes to all corresponding services.
Expected Behavior
All the common code can be extracted to a separate library so that our Program.cs remains neat and clean. When we build multiple micro services in client environment we can just reference the common library and it will be easy to sync any changes from the main github repo as we will need to make changes at just one place.
We can extract all the common logic written in Program.cs and CommandLine.cs to a separate class library e.g Helium.Core and reference that in our web api project.
Here is how the Program.cs will look like after refactoring:
The text was updated successfully, but these errors were encountered: