Ejemplo n.º 1
0
        public void SetCrocoApplication(IServiceCollection services)
        {
            var memCache = new MemoryCache(new MemoryCacheOptions());

            services.AddSingleton <IMemoryCache, MemoryCache>(s => memCache);

            var baseOptions = new EFCrocoApplicationOptions
            {
                CacheManager         = new ApplicationCacheManager(memCache),
                GetDbContext         = () => ChatDbContext.Create(Configuration),
                RequestContextLogger = new CrocoWebAppRequestContextLogger(),
                FileOptions          = new CrocoFileOptions
                {
                    SourceDirectory       = Env.WebRootPath,
                    ImgFileResizeSettings = new List <ImgFileResizeSetting>
                    {
                        new ImgFileResizeSetting
                        {
                            ImageSizeName = ImageSizeType.Icon.ToString(),
                            MaxHeight     = 50,
                            MaxWidth      = 50
                        },

                        new ImgFileResizeSetting
                        {
                            ImageSizeName = ImageSizeType.Small.ToString(),
                            MaxHeight     = 200,
                            MaxWidth      = 200
                        },

                        new ImgFileResizeSetting
                        {
                            ImageSizeName = ImageSizeType.Medium.ToString(),
                            MaxHeight     = 500,
                            MaxWidth      = 500
                        }
                    },
                },
                RootPath         = Env.ContentRootPath,
                AfterInitActions = ApplicationActions
            }.GetApplicationOptions();


            baseOptions.AddDelayedApplicationLogger()
            .AddHangfireEventSourcerAndJobManager();

            var options = new CrocoWebApplicationOptions()
            {
                ApplicationUrl = "https://findtask.ru",
                CrocoOptions   = baseOptions,
            };

            var application = new MyCrocoWebApplication(options)
            {
                IsDevelopment = Env.EnvironmentName == "Development"
            };

            CrocoApp.Application = application;

            services.AddSingleton(CrocoApp.Application);
        }
Ejemplo n.º 2
0
 public MyCrocoWebApplication(CrocoWebApplicationOptions options) : base(options)
 {
 }