Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        // 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
                                 ));
        }
Ejemplo n.º 3
0
        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();
        }