Пример #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(
            IApplicationBuilder app,
            IHostingEnvironment env,
            IApplicationLifetime applicationLifetime)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseErrorHandler();
            app.UseJwtValidatorMiddleware();
            app.UseAuthentication();
            app.UseMvc();

            MongoDbInitializer.RegisterConventions();

            applicationLifetime.ApplicationStopped.Register(() =>
            {
                Container.Dispose();
            });
        }
Пример #2
0
        /// <summary>
        /// Load your modules or register your services here!
        /// </summary>
        /// <param name="kernel">The kernel.</param>
        private static void RegisterServices(IKernel kernel)
        {
            var database = MongoDbInitializer.Init();

            kernel.Bind <MongoDatabase>().ToConstant(database);

            kernel.Bind <IUserRepository>().To <UserRepository>();
            kernel.Bind <IIndexedDocumentRepository>().To <IndexedDocumentRepository>();

            kernel.Bind <ITokenizer>().To <TextTokenizer>();
            kernel.Bind <IStopWordsProvider>().To <RusStopWordsProvider>();
            kernel.Bind <IStemmer>().To <RussianStemmer>();
            kernel.Bind <IWordCounter>().To <WordCounter>();
            kernel.Bind <SearchCore.TextProcessors.DocumentIndexator>().ToSelf();
            kernel.Bind <SearchCore.SearchHelpers.RelevancyCounter>().ToSelf();
        }
Пример #3
0
 public TestFrameworkInitializer(IMessageSink messageSink)
     : base(messageSink)
 {
     JsonWriterSettings.Defaults.Indent = true;
     MongoDbInitializer.Init();
 }