コード例 #1
0
ファイル: Global.asax.cs プロジェクト: simendancer/SolrNet
        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();
        }
コード例 #2
0
ファイル: Startup.cs プロジェクト: SolrNet/SolrNetSampleApps
        // 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
                                 ));
        }
コード例 #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();
        }