// This method gets called by the runtime. Use this method to add services to the container. public virtual IServiceProvider ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc(); services.AddDbContext<RepositorioContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DbApiExemploAutenticacao"))); // Configura a DI var autoFacConfig = new AutoFacConfig(); autoFacConfig.Build(services, Configuration); this.Container = autoFacConfig.Container; return autoFacConfig.Provider; }