Пример #1
2
 public LogManager(ILogRepository logRepository)
 {
     if (logRepository == null)
         this.logRepository = new LogRepository();
     else
         this.logRepository = logRepository;
 }
Пример #2
0
        /// <summary>
        /// Preencho o repositório com as HQs novas
        /// </summary>
        public void Dump(IComicRepository comicRepository, IAuthorRepository authorRepository,
                                IGenreRepository genreRepository, IPublisherRepository publisherRepository,
                                ILogRepository logRepository)
        {
            //Se já processei nesse período, retorno
            DateTime lastSyncDate = logRepository.GetLastComicListUpdate();
            if (lastSyncDate.AddHours(24) > DateTime.Now) return;

            //Espero terminar de processar
            while (_working) Thread.Sleep(10);

            //Busco todas as HQs do banco
            IList<Comic> repoList = comicRepository.Read();

            //Comparo o que mudou
            foreach (ComicVisitor cacheComic in _cache)
            {
                if (repoList.Any(c => c.ComicName.ToUpper().Equals(cacheComic.ComicName.ToUpper()))) continue;

                //Se tem uma HQ nova, adiciono
                Comic dbComic = ComicVisitor.ToComic(cacheComic);
                comicRepository.Add(dbComic);
                cacheComic.ComicId = dbComic.ComicId;
            }

            comicRepository.Save();
            logRepository.SetLastComicListUpdate(DateTime.Now);
        }
Пример #3
0
        public LogListPageModel(ILogRepository logRepository)
        {
            _logRepository = logRepository;
            GetDropDownListData();

            FillLoggerList();
            FillLevelList();
        }
 public static ILoggerFactory AddDbLogger(
     this ILoggerFactory factory,
     IServiceProvider serviceProvider,
     ILogRepository logRepository)
 {
     factory.AddProvider(new DbLoggerProvider(factory.MinimumLevel, serviceProvider, logRepository));
     return factory;
 }
Пример #5
0
 public LogService(ILogRepository logRepository)
 {
     if (logRepository == null)
     {
         throw new ArgumentNullException("logRepository");
     }
     this.logRepository = logRepository;
 }
Пример #6
0
 public MProjectController(IMProjectRepository repoMProject, ILogRepository repoLog, ICompanyRepository repoCompany,IContractorRepository repoContractor,IProjectRepository repoProject)
     : base(repoLog)
 {
     RepoMProject = repoMProject;
     RepoCompany = repoCompany;
     RepoContractor = repoContractor;
     RepoProject = repoProject;
 }
Пример #7
0
        public Logger(ILogRepository logRepository, IDeviceRepository deviceRepository)
        {
            if (logRepository == null) throw new ArgumentNullException(nameof(logRepository));
            if (deviceRepository == null) throw new ArgumentNullException(nameof(_deviceRepository));

            _logRepository = logRepository;
            _deviceRepository = deviceRepository;
        }
Пример #8
0
        public TwitterService(ITwitterExporterService exporterService, ILogRepository logRepository)
        {
            Ensure.That(() => exporterService).IsNotNull();
            Ensure.That(() => logRepository).IsNotNull();

            this.exporterService = exporterService;
            this.logRepository = logRepository;
        }
Пример #9
0
        public LogService(ILogRepository logRepository, IApplicationEventsRepository applicationEventRepository)
        {
            if (logRepository == null) throw new ArgumentNullException("logRepository");
            if (applicationEventRepository == null) throw new ArgumentNullException("applicationEventRepository");

            _logRepository = logRepository;
            _applicationEventRepository = applicationEventRepository;
        }
Пример #10
0
 public DbLoggerProvider(
     LogLevel minimumLevel,
     IServiceProvider serviceProvider,
     ILogRepository logRepository)
 {
     logRepo = logRepository;
     services = serviceProvider;
     this.minimumLevel = minimumLevel;
 }
Пример #11
0
        public FacebookService(IFacebookImporterService importerService, IFacebookExporterService exporterService, ILogRepository logRepository)
        {
            Ensure.That(() => importerService).IsNotNull();
            Ensure.That(() => exporterService).IsNotNull();
            Ensure.That(() => logRepository).IsNotNull();

            this.importerService = importerService;
            this.exporterService = exporterService;
            this.logRepository = logRepository;
        }
Пример #12
0
 public ComicController(IComicRepository repository, IAuthorRepository authorRepository,
                             IGenreRepository genreRepository, IPublisherRepository publisherRepository,
                             IChapterRepository chapterRepository, ILogRepository logRepository)
 {
     _repository = repository;
     _authorRepository = authorRepository;
     _genreRepository = genreRepository;
     _publisherRepository = publisherRepository;
     _chapterRepository = chapterRepository;
     _logRepository = logRepository;
 }
Пример #13
0
        public ComicController()
        {
            DbContext sharedContext = new Data.ComiczillaDb();

            _repository = new ComicRepository(sharedContext);
            _authorRepository = new AuthorRepository(sharedContext);
            _genreRepository = new GenreRepository(sharedContext);
            _publisherRepository = new PublisherRepository(sharedContext);
            _chapterRepository = new ChapterRepository(sharedContext);
            _logRepository = new LogRepository(sharedContext);
        }
Пример #14
0
 public LogMaintainer(
     PHmiModel.Entities.Log log,
     ILogRepository repository,
     ITimeService timeService,
     INpgsqlConnectionFactory connectionFactory)
 {
     _repository = repository;
     _timeService = timeService;
     _connectionFactory = connectionFactory;
     _timeToStore = log.TimeToStoreDb.HasValue ? new TimeSpan(log.TimeToStoreDb.Value) as TimeSpan? : null;
 }
Пример #15
0
 public LogMaintainer(
     logs log,
     ILogRepository repository,
     ITimeService timeService,
     INpgsqlConnectionFactory connectionFactory)
 {
     _repository = repository;
     _timeService = timeService;
     _connectionFactory = connectionFactory;
     _timeToStore = log.time_to_store.HasValue ? new TimeSpan(log.time_to_store.Value) as TimeSpan? : null;
 }
Пример #16
0
 public DbLogger(
     string loggerName,
     LogLevel minimumLevel,
     IServiceProvider serviceProvider,
     ILogRepository logRepository)
 {
     logger = loggerName;
     logRepo = logRepository;
     services = serviceProvider;
     this.minimumLevel = minimumLevel;
 }
Пример #17
0
        public MainViewModel(IApplicationRepository applicationRepository, IFunctionalityToggler functionalityToggler, ILogRepository logRepository,
            ILocationRepository locationRepository, IDeviceRepository deviceRepository, ICredentialsRepository credentialsRepository,
            IFirstTimeUserExperienceTracker firstTimeUserExperienceTracker, IActionRepository actionRepository)
        {
            if (applicationRepository == null) throw new ArgumentNullException(nameof(applicationRepository));
            if (functionalityToggler == null) throw new ArgumentNullException(nameof(functionalityToggler));
            if (logRepository == null) throw new ArgumentNullException(nameof(logRepository));
            if (locationRepository == null) throw new ArgumentNullException(nameof(locationRepository));
            if (deviceRepository == null) throw new ArgumentNullException(nameof(deviceRepository));
            if (actionRepository == null) throw new ArgumentNullException(nameof(actionRepository));
            if (credentialsRepository == null) throw new ArgumentNullException(nameof(credentialsRepository));
            if (firstTimeUserExperienceTracker == null) throw new ArgumentNullException(nameof(firstTimeUserExperienceTracker));

            _applicationRepository = applicationRepository;
            _functionalityToggler = functionalityToggler;
            _logRepository = logRepository;
            _locationRepository = locationRepository;
            _deviceRepository = deviceRepository;
            _actionRepository = actionRepository;
            _credentialsRepository = credentialsRepository;
            _firstTimeUserExperienceTracker = firstTimeUserExperienceTracker;

            if (IsInDesignMode)
            {
                IsFirstTimeUserExperience = false;

                Activities = new ObservableCollection<ActivityViewModel>
                {
                    new ActivityViewModel(DateTimeOffset.UtcNow, "Home")
                    {
                        Actions = new List<string> { "switch on Desk lamp", $"Failed to control IFTTT{Environment.NewLine}This is what happened: (NotFound Not Found..." }
                    },
                    new ActivityViewModel(DateTimeOffset.UtcNow.AddDays(-1), "Away")
                    {
                        Actions = new List<string> { "switch off TV", "set to 16°C heating" }
                    },
                    new ActivityViewModel(DateTimeOffset.UtcNow.AddDays(-10), "Home")
                    {
                        Actions = new List<string> { "switch on TV", "set to 16°C heating" }
                    }
                };

                IsFirstTimeUserExperienceHomeStep = true;
            }
            else
            {
                Activities = new ObservableCollection<ActivityViewModel>();
            }

            UpdateFirstTimeUserExperienceCommand = new TransactionalCommandTask(UpdateFirstTimeUserExperience);
            NavigateToSettingsCommand = new RelayCommand(NavigateToSettings);
        }
Пример #18
0
        public PostController(IDiscussionsContext context,
            IUsageContext usageContext,
            IPostRepository<Post> postRepository,
            IUsersRepository<User> userRepository,
            IDiscussionRepository<Discussion> discussionRepository,
            ILogRepository<Log> logRepository,
            ILogTypeRepository<LogType> logTypeRepository)
        {
            _context = context;
            _usageContext = usageContext;
            _postRepository = postRepository;
            _userRepository = userRepository;
            _discussionRepository = discussionRepository;
            _logRepository = logRepository;
            _logTypeRepository = logTypeRepository;

            Mapper.AddProfile<PostsMappingProfile>();
        }
Пример #19
0
        public SystemInfoManager(
            IRuntimeEnvironment runtimeEnvironment,
            IHostingEnvironment hostingEnvironment,
            IApplicationEnvironment appEnvironment,
            IVersionProviderFactory versionProviderFactory,
            IDb database,
            ILogRepository logRepository)
        {
            runtimeInfo = runtimeEnvironment;
            appInfo = appEnvironment;
            hostingInfo = hostingEnvironment;
            db = database;
            logRepo = logRepository;
            versionProviders = versionProviderFactory;
            cloudscribeVersionProvider = versionProviders.Get("cloudscribe-core");


        }
Пример #20
0
 public LogController(ILogRepository rep)
 {
     repo = rep;
 }
Пример #21
0
        // Configure is called after ConfigureServices is called.
        // you can change this method signature to include any dependencies that need to be injected into this method
        // you can see we added the dependency for IOptions<MultiTenantOptions>
        // so basically if you need any service in this method that was previously setup in ConfigureServices
        // you can just add it to the method signature and it will be provided by dependency injection
        public void Configure(
            IApplicationBuilder app, 
            IHostingEnvironment env, 
            ILoggerFactory loggerFactory,
            IOptions<MultiTenantOptions> multiTenantOptions,
            IServiceProvider serviceProvider,
            ILogRepository logRepository)
        {
            // Configure the HTTP request pipeline.

            // LogLevels
            //Debug = 1,
            //Verbose = 2,
            //Information = 3,
            //Warning = 4,
            //Error = 5,
            //Critical = 6,
            loggerFactory.MinimumLevel = LogLevel.Information;
            // Add the console logger.
            loggerFactory.AddConsole();
            // Add cloudscribe db logging
            loggerFactory.AddDbLogger(serviceProvider, logRepository);
           

            // Add the following to the request pipeline only in development environment.
            if (env.IsEnvironment("Development"))
            {
                //app.UseBrowserLink();

                app.UseErrorPage();

                //app.UseDatabaseErrorPage(DatabaseErrorPageOptions.ShowAll);
                //app.UseStatusCodePagesWithReExecute("/error/{0}");
                app.UseStatusCodePagesWithReExecute("/error/{0}");
            }
            else
            {
                // Add Error handling middleware which catches all application specific errors and
                // sends the request to the following path or controller action.
                //app.UseErrorHandler("/Home/Error");
                //app.UseErrorPage(ErrorPageOptions.ShowAll);

                // handle 404 and other non success
                //app.UseStatusCodePages();

                // app.UseStatusCodePages(context => context.HttpContext.Response.SendAsync("Handler, status code: " + context.HttpContext.Response.StatusCode, "text/plain"));
                // app.UseStatusCodePages("text/plain", "Response, status code: {0}");
                // app.UseStatusCodePagesWithRedirects("~/errors/{0}"); // PathBase relative
                // app.UseStatusCodePagesWithRedirects("/base/errors/{0}"); // Absolute
                // app.UseStatusCodePages(builder => builder.UseWelcomePage());
                //app.UseStatusCodePagesWithReExecute("/errors/{0}");
                //app.UseStatusCodePagesWithReExecute("/error/{0}");
            }

            //app.UseRuntimeInfoPage("/info");

            // Add static files to the request pipeline.
            app.UseStaticFiles();

            // the only thing we are using session for is Alerts
            app.UseSession();
            //app.UseInMemorySession(configure: s => s.IdleTimeout = TimeSpan.FromMinutes(20));
            

            // this is in Startup.CloudscribeCore.cs
            app.UseCloudscribeCore(multiTenantOptions);

            // it is very important that all authentication configuration be set before configuring mvc
            // ie if app.UseFacebookAuthentication(); was below app.UseMvc the facebook login button will not be shown

            
            // Add MVC to the request pipeline.
            app.UseMvc(routes =>
            {
                //if you are adding custom routes you should probably put them first
                // add your routes here


                // default route for folder sites must be second to last
                if (multiTenantOptions.Options.Mode == MultiTenantMode.FolderName)
                {
                    routes.MapRoute(
                    name: "folderdefault",
                    template: "{sitefolder}/{controller}/{action}/{id?}",
                    defaults: new { controller = "Home", action = "Index" },
                    constraints: new { name = new SiteFolderRouteConstraint() }
                    );
                }


                // the default route has to be added last
                routes.MapRoute(
                    name: "default",
                    template: "{controller}/{action}/{id?}",
                    defaults: new { controller = "Home", action = "Index" }

                    );

                // Uncomment the following line to add a route for porting Web API 2 controllers.
                // routes.MapWebApiRoute("DefaultApi", "api/{controller}/{id?}");
            })
            ;

            // https://github.com/aspnet/Announcements/issues/54
            // if you want to run the IIS pipeline for requests not handled 
            // ie you won't see the IIS 404 page without this.
            // if nothing else handles the 404 then you get a blank white page in the browser
            //app.RunIISPipeline();

            //app.Run(context =>
            //{
            //    context.Response.StatusCode = 404;
            //    return Task.FromResult(0);
            //});



        }
Пример #22
0
 public LogViewer(ILogRepository logRepository)
 {
     this.logRepository = logRepository;
 }
Пример #23
0
        // Configure is called after ConfigureServices is called.
        // you can change this method signature to include any dependencies that need to be injected into this method
        // you can see we added the dependency for IOptions<MultiTenantOptions>
        // so basically if you need any service in this method that was previously setup in ConfigureServices
        // you can just add it to the method signature and it will be provided by dependency injection
        public void Configure(
            IApplicationBuilder app, 
            IHostingEnvironment env, 
            ILoggerFactory loggerFactory,
            IOptions<MultiTenantOptions> multiTenantOptions,
            IServiceProvider serviceProvider,
            ILogRepository logRepository)
        {
            // Configure the HTTP request pipeline.

            //http://blog.getglimpse.com/2015/11/19/installing-glimpse-v2-beta1/
            bool enableGlimpse = Configuration.Get<bool>("DiagnosticOptions:EnableGlimpse", false);
            if(enableGlimpse)
            {
                app.UseGlimpse();
            }


            // LogLevels
            //Debug = 1,
            //Trace = 2,
            //Information = 3,
            //Warning = 4,
            //Error = 5,
            //Critical = 6,
            
            // Add the console logger.
            loggerFactory.AddConsole(minLevel: LogLevel.Warning);
            
            // a customizable filter for logging
            LogLevel minimumLevel = LogLevel.Warning;
            List<string> excludedLoggers = new List<string>();
            // add exclusions to remove noise in the logs

            // we need to filter out EF otherwise each time we persist a log item to the db more logs are generated
            // so it can become an infinite loop that keeps creating data
            // you can add any loggers that you want to exclude to reduce noise in the log
            excludedLoggers.Add("Microsoft.Data.Entity.Storage.Internal.RelationalCommandBuilderFactory");
            excludedLoggers.Add("Microsoft.Data.Entity.Query.Internal.QueryCompiler");
            excludedLoggers.Add("Microsoft.Data.Entity.DbContext");

            Func<string, LogLevel, bool> logFilter = delegate (string loggerName, LogLevel logLevel)
            {
                if (logLevel < minimumLevel) { return false; }
                if(excludedLoggers.Contains(loggerName)) { return false; }

                return true;
            };
            // Add cloudscribe db logging
            loggerFactory.AddDbLogger(serviceProvider, logRepository, logFilter);
            


            //app.UseCultureReplacer();

            // localization from .resx files is not really working in beta8
            // will have to wait till next release

            var supportedCultures = new[]
            {
                new CultureInfo("en-US"),
                new CultureInfo("it"),
                new CultureInfo("fr-FR")
            };

            var locOptions = new RequestLocalizationOptions
            {
                // You must explicitly state which cultures your application supports.
                // These are the cultures the app supports for formatting numbers, dates, etc.
                SupportedCultures = supportedCultures,
                SupportedUICultures = supportedCultures

            };
            // You can change which providers are configured to determine the culture for requests, or even add a custom
            // provider with your own logic. The providers will be asked in order to provide a culture for each request,
            // and the first to provide a non-null result that is in the configured supported cultures list will be used.
            // By default, the following built-in providers are configured:
            // - QueryStringRequestCultureProvider, sets culture via "culture" and "ui-culture" query string values, useful for testing
            // - CookieRequestCultureProvider, sets culture via "ASPNET_CULTURE" cookie
            // - AcceptLanguageHeaderRequestCultureProvider, sets culture via the "Accept-Language" request header
            //locOptions.RequestCultureProviders.Insert(0, new CustomRequestCultureProvider(async context =>
            //{
            //  // My custom request culture logic
            //  return new ProviderCultureResult("en");
            //}));
            //app.UseRequestLocalization(locOptions, 
            //    defaultRequestCulture: new RequestCulture(culture: "en-US", uiCulture: "en-US"));

            
            // Add the following to the request pipeline only in development environment.
            if (env.IsEnvironment("Development"))
            {
                //app.UseBrowserLink();

                app.UseDeveloperExceptionPage();
                
                //app.UseDatabaseErrorPage(DatabaseErrorPageOptions.ShowAll);
                //app.UseStatusCodePagesWithReExecute("/error/{0}");
                //app.UseStatusCodePagesWithReExecute("/error/{0}");
            }
            else
            {
                
                app.UseExceptionHandler("/Home/Error");

                // handle 404 and other non success
                //app.UseStatusCodePages();

                // app.UseStatusCodePages(context => context.HttpContext.Response.SendAsync("Handler, status code: " + context.HttpContext.Response.StatusCode, "text/plain"));
                // app.UseStatusCodePages("text/plain", "Response, status code: {0}");
                // app.UseStatusCodePagesWithRedirects("~/errors/{0}"); // PathBase relative
                // app.UseStatusCodePagesWithRedirects("/base/errors/{0}"); // Absolute
                // app.UseStatusCodePages(builder => builder.UseWelcomePage());
                //app.UseStatusCodePagesWithReExecute("/errors/{0}");
                //app.UseStatusCodePagesWithReExecute("/error/{0}");
            }

            // Add the platform handler to the request pipeline.
            //app.UseIISPlatformHandler();
            app.UseIISPlatformHandler(options => options.AuthenticationDescriptions.Clear());

            //app.UseRuntimeInfoPage("/info");

            // Add static files to the request pipeline.
            app.UseStaticFiles();
            
            // the only thing we are using session for is Alerts
            app.UseSession();
            //app.UseInMemorySession(configure: s => s.IdleTimeout = TimeSpan.FromMinutes(20));

            app.UseMultitenancy<SiteSettings>();

            // this is in Startup.CloudscribeCore.cs
            app.UseCloudscribeCore(multiTenantOptions,Configuration);

            // it is very important that all authentication configuration be set before configuring mvc
            // ie if app.UseFacebookAuthentication(); was below app.UseMvc the facebook login button will not be shown

            
            // Add MVC to the request pipeline.
            app.UseMvc(routes =>
            {
                // Understanding ASP.NET Routing:

                // it is very important that routes are registered in the correct order. more specific routes must be registered first and 
                // less specific routes must be registered later. a request may match more than one route.

                // When a request comes in it is compared to routes in the route table and the first route it matches is used no matter if a 
                // better match exists. therefore if a less specific route is registered first it will catch requests that would have a better 
                // match with a more specific route that was registered later.

                // ie the default route is usually the least specific route and must be registered last

                // something like a route for a cms would likely need to be the default route added last especially if you are not going to use 
                // a controller segment in the route because without a controller segment the route is less specific


                // default route for folder sites must be second to last
                if (multiTenantOptions.Value.Mode == MultiTenantMode.FolderName)
                {
                    routes.MapRoute(
                    name: "folderdefault",
                    template: "{sitefolder}/{controller}/{action}/{id?}",
                    defaults: new { controller = "Home", action = "Index" },
                    constraints: new { name = new SiteFolderRouteConstraint() }
                    );
                }


                // the default route has to be added last
                routes.MapRoute(
                    name: "default",
                    template: "{controller}/{action}/{id?}",
                    defaults: new { controller = "Home", action = "Index" }
                    );

                // Uncomment the following line to add a route for porting Web API 2 controllers.
                // routes.MapWebApiRoute("DefaultApi", "api/{controller}/{id?}");
            })
            ;

            // https://github.com/aspnet/Announcements/issues/54
            // if you want to run the IIS pipeline for requests not handled 
            // ie you won't see the IIS 404 page without this.
            // if nothing else handles the 404 then you get a blank white page in the browser
            //app.RunIISPipeline();

            //app.Run(context =>
            //{
            //    context.Response.StatusCode = 404;
            //    return Task.FromResult(0);
            //});

            DevOptions devOptions = Configuration.Get<DevOptions>("DevOptions");
            if (devOptions.DbPlatform == "ef7")
            {
                cloudscribe.Core.Repositories.EF.InitialData.InitializeDatabaseAsync(app.ApplicationServices).Wait();
                // this is using EF for the logger but using EF for Core does not mean you must use EF for logging
                // one should be able to use the MSSQL Logger while still using EF for the core repos
                // one problem with EF logging is that EF logs a lot of information stuff and if we use EF for logigng
                // then every time a log item is inserted to the db it generates more logging events
                // and thus a continuous creation of data can result so the EF logger is designed to leave out
                // EF components from logging
                // by using the mssql logger instead then no extra log items will be created and you can more easily allow
                // EF to log things of its own
                // however the mssql logger depends on the setup system which is not used by EF components
                // this dependency is more practical than technical though, you could run the db setup script for mssql logging
                // manually instead of using the setup system.
                cloudscribe.Logging.EF.DbInitializer.InitializeDatabaseAsync(app.ApplicationServices).Wait();
            }



        }
 public LogController(ILogRepository logRepository)
 {
     _logRepository = logRepository;
 }
        public void SetUp()
        {
            _logRepository = new LogRepository();
            _personRepository = new PersonRepository();

            dataHelper = new IntegrationTestData();
            dataHelper.SetUp();
        }
Пример #26
0
        // Configure is called after ConfigureServices is called.
        // you can change this method signature to include any dependencies that need to be injected into this method
        // you can see we added the dependency for IOptions<MultiTenantOptions>
        // so basically if you need any service in this method that was previously setup in ConfigureServices
        // you can just add it to the method signature and it will be provided by dependency injection
        public void Configure(
            IApplicationBuilder app, 
            IHostingEnvironment env, 
            ILoggerFactory loggerFactory,
            IOptions<MultiTenantOptions> multiTenantOptions,
            IServiceProvider serviceProvider,
            ILogRepository logRepository)
        {
            // Configure the HTTP request pipeline.

            // LogLevels
            //Debug = 1,
            //Verbose = 2,
            //Information = 3,
            //Warning = 4,
            //Error = 5,
            //Critical = 6,
            loggerFactory.MinimumLevel = LogLevel.Information;
            // Add the console logger.
            loggerFactory.AddConsole();
            // Add cloudscribe db logging
            loggerFactory.AddDbLogger(serviceProvider, logRepository);

            //app.UseCultureReplacer();

            // localization from .resx files is not really working in beta8
            // will have to wait till next release

            var localizationOptions = new RequestLocalizationOptions
            {
                // Set options here to change middleware behavior
                
                //DefaultRequestCulture = new RequestCulture(new CultureInfo("en-US")),
                SupportedCultures = new List<CultureInfo>
                {
                    new CultureInfo("en-US"),
                    new CultureInfo("it"),
                    new CultureInfo("fr")
                },
                SupportedUICultures = new List<CultureInfo>
                {
                    new CultureInfo("en-US"),
                    new CultureInfo("it"),
                    new CultureInfo("fr")
                }
                

            };



            // Optionally create an app-specific provider with just a delegate, e.g. look up user preference from DB.
            // Inserting it as position 0 ensures it has priority over any of the default providers.
            //options.RequestCultureProviders.Insert(0, new CustomRequestCultureProvider(async context =>
            //{

            //}));

            //app.UseRequestLocalization(localizationOptions);
            var defaultCulture = new RequestCulture(new CultureInfo("en-US"));
            //app.UseRequestLocalization(localizationOptions, defaultCulture);


            // Add the following to the request pipeline only in development environment.
            if (env.IsEnvironment("Development"))
            {
                //app.UseBrowserLink();

                app.UseDeveloperExceptionPage();
                
                //app.UseDatabaseErrorPage(DatabaseErrorPageOptions.ShowAll);
                //app.UseStatusCodePagesWithReExecute("/error/{0}");
                //app.UseStatusCodePagesWithReExecute("/error/{0}");
            }
            else
            {
                // Add Error handling middleware which catches all application specific errors and
                // sends the request to the following path or controller action.
                //app.UseErrorHandler("/Home/Error");
                //app.UseErrorPage(ErrorPageOptions.ShowAll);

                // handle 404 and other non success
                //app.UseStatusCodePages();

                // app.UseStatusCodePages(context => context.HttpContext.Response.SendAsync("Handler, status code: " + context.HttpContext.Response.StatusCode, "text/plain"));
                // app.UseStatusCodePages("text/plain", "Response, status code: {0}");
                // app.UseStatusCodePagesWithRedirects("~/errors/{0}"); // PathBase relative
                // app.UseStatusCodePagesWithRedirects("/base/errors/{0}"); // Absolute
                // app.UseStatusCodePages(builder => builder.UseWelcomePage());
                //app.UseStatusCodePagesWithReExecute("/errors/{0}");
                //app.UseStatusCodePagesWithReExecute("/error/{0}");
            }

            // Add the platform handler to the request pipeline.
            //app.UseIISPlatformHandler();
            app.UseIISPlatformHandler(options => options.AuthenticationDescriptions.Clear());

            //app.UseRuntimeInfoPage("/info");

            // Add static files to the request pipeline.
            app.UseStaticFiles();

            // the only thing we are using session for is Alerts
            app.UseSession();
            //app.UseInMemorySession(configure: s => s.IdleTimeout = TimeSpan.FromMinutes(20));
            

            // this is in Startup.CloudscribeCore.cs
            app.UseCloudscribeCore(multiTenantOptions,Configuration);

            // it is very important that all authentication configuration be set before configuring mvc
            // ie if app.UseFacebookAuthentication(); was below app.UseMvc the facebook login button will not be shown

            
            // Add MVC to the request pipeline.
            app.UseMvc(routes =>
            {
                // Understanding ASP.NET Routing:

                // it is very important that routes are registered in the correct order. more specific routes must be registered first and 
                // less specific routes must be registered later. a request may match more than one route.

                // When a request comes in it is compared to routes in the route table and the first route it matches is used no matter if a 
                // better match exists. therefore if a less specific route is registered first it will catch requests that would have a better 
                // match with a more specific route that was registered later.

                // ie the default route is usually the least specific route and must be registered last

                // something like a route for a cms would likely need to be the default route added last especially if you are not going to use 
                // a controller segment in the route because without a controller segment the route is less specific


                // default route for folder sites must be second to last
                if (multiTenantOptions.Value.Mode == MultiTenantMode.FolderName)
                {
                    routes.MapRoute(
                    name: "folderdefault",
                    template: "{sitefolder}/{controller}/{action}/{id?}",
                    defaults: new { controller = "Home", action = "Index" },
                    constraints: new { name = new SiteFolderRouteConstraint() }
                    );
                }


                // the default route has to be added last
                routes.MapRoute(
                    name: "default",
                    template: "{controller}/{action}/{id?}",
                    defaults: new { controller = "Home", action = "Index" }
                    );

                // Uncomment the following line to add a route for porting Web API 2 controllers.
                // routes.MapWebApiRoute("DefaultApi", "api/{controller}/{id?}");
            })
            ;

            // https://github.com/aspnet/Announcements/issues/54
            // if you want to run the IIS pipeline for requests not handled 
            // ie you won't see the IIS 404 page without this.
            // if nothing else handles the 404 then you get a blank white page in the browser
            //app.RunIISPipeline();

            //app.Run(context =>
            //{
            //    context.Response.StatusCode = 404;
            //    return Task.FromResult(0);
            //});



        }
Пример #27
0
 public LogService(ILogRepository logRepository)
 {
     _logRepository = logRepository;
 }
Пример #28
0
        public LogService(ILogRepository logRepository)
        {
            Ensure.That(() => logRepository).IsNotNull();

            this.logRepository = logRepository;
        }
Пример #29
0
 public HomeController(ILogRepository repoLog)
     : base(repoLog)
 {
 }
Пример #30
0
 public TestController(ILogRepository repoLog)
 {
     RepoLog = repoLog;
 }