private static async Task StartAsync(string path, ActionType action, string pathLogFileResult) { try { ServicesRegister sReg = new ServicesRegister(pathLogFileResult); using (var scope = sReg.Container.BeginLifetimeScope()) { var runner = scope.Resolve <IRunner>(); runner.Run(); var fileSearcher = scope.ResolveKeyed <IFileSearcher>(action); var result = await fileSearcher.GetFilePaths(path); runner.Logging(result); } } catch (Exception ex) { Console.WriteLine($"Error: {ex.Message}"); //throw; } }
public static async Task Main(string[] args) { var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.RootComponents.Add <App>("app"); builder.Services.AddScoped( sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); builder.Services.AddAutoMapper( cfg => { cfg.AddCollectionMappers(); cfg.AddProfile <AutoMappingProfile>(); }); ServicesRegister.Init(builder.Services); await builder.Build().RunAsync(); }
public static void RegisterServices(IServiceCollection services, IConfiguration configuration) { SwaggerRegister.RegisterServices(services); MongoDbRegister.RegisterServices(services, configuration); ServicesRegister.RegisterServices(services); }
private void IoC(ref IServiceCollection services) { ServicesRegister.AddServicesScope(services, typeof(ProductRepository).Assembly, "Repository"); ServicesRegister.AddServicesScope(services, typeof(ImageService).Assembly, "Service"); }