示例#1
0
        public void OnApplicationStartup(IServiceCollection services)
        {
            var tokenizer = new LatinTokenizer();

            services.AddSingleton(typeof(LocalStorageSessionFactory), new LocalStorageSessionFactory(Path.Combine(Directory.GetCurrentDirectory(), "App_Data"), tokenizer));
            services.Add(new ServiceDescriptor(typeof(ITokenizer), tokenizer));
        }
示例#2
0
文件: Start.cs 项目: jobs-git/resin
        public void OnApplicationStartup(IServiceCollection services, ServiceProvider serviceProvider)
        {
            var tokenizer = new LatinTokenizer();
            var config    = serviceProvider.GetService <IConfigurationService>();

            services.AddSingleton(typeof(SessionFactory),
                                  new SessionFactory(
                                      config.Get("data_dir"),
                                      tokenizer,
                                      config));

            services.AddSingleton(typeof(ITokenizer), tokenizer);

            services.AddSingleton(typeof(HttpQueryParser), new HttpQueryParser(new KeyValueBooleanQueryParser()));
        }
示例#3
0
        public void OnApplicationStartup(IServiceCollection services, ServiceProvider serviceProvider)
        {
            var tokenizer = new LatinTokenizer();
            var config    = serviceProvider.GetService <IConfigurationProvider>();

            services.AddSingleton(typeof(SessionFactory),
                                  new SessionFactory(
                                      config.Get("data_dir"),
                                      tokenizer,
                                      config));

            services.AddSingleton(typeof(ITokenizer), tokenizer);

            services.AddSingleton(typeof(HttpQueryParser), new HttpQueryParser(new TermQueryParser(), tokenizer));
            services.AddSingleton(typeof(HttpBowQueryParser), new HttpBowQueryParser(tokenizer));
            services.AddSingleton(typeof(IQueryFormatter), new QueryFormatter());
        }