// This method gets called by the runtime. Use this method to add services to the container. public IServiceProvider ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc(); var bootStrapper = new AutofacBootStrapper(); var builder = bootStrapper.GetBuilder(); builder.Populate(services); var container = bootStrapper.GetContainer(); return(container.Resolve <IServiceProvider> ()); }
public static void Main(string[] args) { var bootStrapper = new AutofacBootStrapper(); var stockService = bootStrapper.GetContainer().Resolve <IStockService> (); var result = Parser.Default.ParseArguments <CLIOptions> (args); result.MapResult(o => { var fullPath = Path.GetFullPath(o.InputFile); if (File.Exists(fullPath)) { stockService.ImportStocksByCSVFile(fullPath); } return(0); }, errs => 1); }