示例#1
0
        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;
            }
        }
示例#2
0
        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();
        }
示例#3
0
 public static void RegisterServices(IServiceCollection services, IConfiguration configuration)
 {
     SwaggerRegister.RegisterServices(services);
     MongoDbRegister.RegisterServices(services, configuration);
     ServicesRegister.RegisterServices(services);
 }
示例#4
0
 private void IoC(ref IServiceCollection services)
 {
     ServicesRegister.AddServicesScope(services, typeof(ProductRepository).Assembly, "Repository");
     ServicesRegister.AddServicesScope(services, typeof(ImageService).Assembly, "Service");
 }