protected void Application_Start() { XmlConfigurator.ConfigureAndWatch(new FileInfo(Path.Combine(Server.MapPath("/"), "log4net.config"))); RegisterRoutes(RouteTable.Routes); var connection = new SolrConnection(solrURL); var loggingConnection = new LoggingConnection(connection); Startup.Init<Product>(loggingConnection); RegisterAllControllers(); ControllerBuilder.Current.SetControllerFactory(new ServiceProviderControllerFactory(Startup.Container)); ModelBinders.Binders[typeof (SearchParameters)] = new SearchParametersBinder(); AddInitialDocuments(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllersWithViews(); services.AddSolrNet <Product>("http://localhost:8983/solr/techproducts"); services.Replace(new ServiceDescriptor( typeof(ISolrInjectedConnection <Product>), s => { var logConn = new LoggingConnection(s.GetRequiredService <ISolrConnection>(), s.GetRequiredService <ILogger <LoggingConnection> >()); return(new BasicInjectionConnection <Product>(logConn)); }, ServiceLifetime.Singleton )); }
protected void Application_Start() { XmlConfigurator.ConfigureAndWatch(new FileInfo(Path.Combine(Server.MapPath("/"), "log4net.config"))); RegisterRoutes(RouteTable.Routes); var connection = new SolrConnection(solrURL); var loggingConnection = new LoggingConnection(connection); Startup.Init <Product>(loggingConnection); RegisterAllControllers(); ControllerBuilder.Current.SetControllerFactory(new ServiceProviderControllerFactory(Startup.Container)); ModelBinders.Binders[typeof(SearchParameters)] = new SearchParametersBinder(); //AddInitialDocuments(); }