Example #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();
            var assemblyDiscovery = new AssemblyDiscovery("HR*.dll");
            var registrars        = assemblyDiscovery.DiscoverInstance <IRegistrar>("HR").ToList();

            foreach (var registrar in registrars)
            {
                registrar.Register(services, assemblyDiscovery);;
            }
            services.AddDbContext <IDbContext, HRDbContext>(op =>
            {
                op.UseSqlServer("Data Source=localhost;Initial Catalog=HR;Integrated Security=True");
            });
            services.AddControllersWithViews();
        }