Example #1
0
        public static void Setup()
        {
            if (_container == null)
            {
                _container = new ServiceCollection();
                _container.AddSingleton(GetConfiguration());

                DIBootstrap.RegisterTypes(_container);
            }
        }
Example #2
0
        public static IHostBuilder CreateHostBuilder(string[] args) =>
        Host.CreateDefaultBuilder(args)
        //Dependency Injection :)
        .ConfigureServices((_, services) => DIBootstrap.RegisterTypes(services))
        .ConfigureAppConfiguration((hostingContext, configuration) =>
        {
            var current     = Directory.GetCurrentDirectory();
            var directories = Directory.GetParent(current)
                              .Parent.Parent.Parent.GetDirectories();
            var config = directories.Where(x => x.FullName.Contains("LeandroExRate.App"))?.First()?.FullName;


            //Configuration :)
            var builder = configuration
                          .SetBasePath(config)
                          .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);

            builder.Build();
        });
Example #3
0
 private static void ConfigureServices(IServiceCollection serviceCollection)
 {
     DIBootstrap.Configure(serviceCollection, Configuration);
 }