• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# DotlessConfiguration类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中DotlessConfiguration的典型用法代码示例。如果您正苦于以下问题:C# DotlessConfiguration类的具体用法?C# DotlessConfiguration怎么用?C# DotlessConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DotlessConfiguration类属于命名空间,在下文中一共展示了DotlessConfiguration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: BaseSetup

        public void BaseSetup()
        {
            HttpContext = new Mock<HttpContextBase>();
            HttpRequest = new Mock<HttpRequestBase>();
            HttpResponse = new Mock<HttpResponseBase>();
            HttpSession = new Mock<HttpSessionStateBase>();
            HttpServer = new Mock<HttpServerUtilityBase>();
            HttpCache = new Mock<HttpCachePolicyBase>();
            Http = new Mock<IHttp>();
            Clock = new Mock<IClock>();
            ConfigManager = new Mock<IConfigurationManager>();

            QueryString = new NameValueCollection();
            Form = new NameValueCollection();
            Headers = new NameValueCollection();
            Config = DotlessConfiguration.GetDefaultWeb();

            Http.SetupGet(h => h.Context).Returns(HttpContext.Object);

            ConfigManager.Setup(c => c.GetSection<DotlessConfiguration>(It.IsRegex("^dotless$"))).Returns(Config);
            DotlessConfiguration.ConfigurationManager = ConfigManager.Object;

            Now = DateTime.Now;
            Clock.Setup(c => c.GetUtcNow()).Returns(Now);

            HttpContext.SetupGet(c => c.Request).Returns(HttpRequest.Object);
            HttpContext.SetupGet(c => c.Response).Returns(HttpResponse.Object);
            HttpContext.SetupGet(c => c.Server).Returns(HttpServer.Object);
            HttpContext.SetupGet(c => c.Session).Returns(HttpSession.Object);
            HttpResponse.SetupGet(r => r.Cache).Returns(HttpCache.Object);
            HttpResponse.SetupGet(r => r.Filter).Returns(new MemoryStream(new byte[1000], true));
            HttpRequest.SetupGet(r => r.QueryString).Returns(QueryString);
            HttpRequest.SetupGet(r => r.Form).Returns(Form);
            HttpRequest.SetupGet(r => r.Headers).Returns(Headers);
        }
开发者ID:Ralphvanderneut,项目名称:dotless,代码行数:35,代码来源:HttpFixtureBase.cs


示例2: RegisterWebServices

        private void RegisterWebServices(FluentRegistration pandora, DotlessConfiguration configuration)
        {
            pandora.Service<IHttp>().Implementor<Http>().Lifestyle.Transient();
            pandora.Service<HandlerImpl>().Implementor<HandlerImpl>().Lifestyle.Transient();

            if (!configuration.DisableParameters)
            {
                pandora.Service<IParameterSource>().Implementor<QueryStringParameterSource>().Lifestyle.Transient();
            }

            var responseService = configuration.CacheEnabled ?
                pandora.Service<IResponse>().Implementor<CachedCssResponse>() :
                pandora.Service<IResponse>().Implementor<CssResponse>();
            pandora.Service<IClock>().Implementor<Clock>();

            responseService.Parameters("isCompressionHandledByResponse").Set("default-is-compression-handled-by-response").Lifestyle.Transient();
            pandora.Service<bool>("default-is-compression-handled-by-response").Instance(configuration.HandleWebCompression);

            if (configuration.CacheEnabled)
            {
                responseService.Parameters("httpExpiryInMinutes").Set("http-expiry-in-minutes").Lifestyle.Transient();
                pandora.Service<int>("http-expiry-in-minutes").Instance(configuration.HttpExpiryInMinutes);
            }

            pandora.Service<ICache>().Implementor<HttpCache>().Lifestyle.Transient();
            pandora.Service<ILogger>().Implementor<AspResponseLogger>().Parameters("level").Set("error-level").Lifestyle.Transient();

            if (configuration.MapPathsToWeb)
                pandora.Service<IPathResolver>().Implementor<AspServerPathResolver>().Lifestyle.Transient();
            else
                pandora.Service<IPathResolver>().Implementor<AspRelativePathResolver>().Lifestyle.Transient();
        }
开发者ID:helephant,项目名称:dotless,代码行数:32,代码来源:AspNetContainerFactory.cs


示例3: RegisterCoreServices

        private void RegisterCoreServices(FluentRegistration pandora, DotlessConfiguration configuration)
        {
            pandora.Service<LogLevel>("error-level")
                .Instance(configuration.LogLevel);

            pandora.Service<int>("default-optimization")
                .Instance(configuration.Optimization);

            pandora.Service<bool>("minify-output")
                .Instance(configuration.MinifyOutput);

            pandora.Service<IStylizer>()
                .Implementor<PlainStylizer>();

            pandora.Service<Parser.Parser>()
                .Implementor<Parser.Parser>()
                    .Parameters("optimization").Set("default-optimization")
                .Lifestyle.Transient();

            pandora.Service<ILessEngine>()
                .Implementor<ParameterDecorator>().Lifestyle.Transient();

            if (configuration.CacheEnabled)
                pandora.Service<ILessEngine>()
                    .Implementor<CacheDecorator>().Lifestyle.Transient();

            pandora.Service<ILessEngine>()
                .Implementor<LessEngine>()
                    .Parameters("compress").Set("minify-output")
                .Lifestyle.Transient();

            pandora.Service<IFileReader>()
                .Implementor(configuration.LessSource);
        }
开发者ID:cynosura,项目名称:dotless,代码行数:34,代码来源:ContainerFactory.cs


示例4: RegisterCoreServices

        protected virtual void RegisterCoreServices(FluentRegistration pandora, DotlessConfiguration configuration)
        {
            pandora.Service<LogLevel>("error-level").Instance(configuration.LogLevel);
            pandora.Service<IStylizer>().Implementor<PlainStylizer>();

            var importer = pandora.Service<IImporter>().Implementor<Importer>();

            importer.Parameters("inlineCssFiles").Set("default-inline-css-files").Lifestyle.Transient();
            importer.Parameters("disableUrlRewriting").Set("default-disable-url-rewriting").Lifestyle.Transient();
            importer.Parameters("importAllFilesAsLess").Set("default-import-all-files-as-less").Lifestyle.Transient();

            pandora.Service<bool>("default-disable-url-rewriting").Instance(configuration.DisableUrlRewriting);
            pandora.Service<bool>("default-inline-css-files").Instance(configuration.InlineCssFiles);
            pandora.Service<bool>("default-import-all-files-as-less").Instance(configuration.ImportAllFilesAsLess);

            pandora.Service<Parser.Parser>().Implementor<Parser.Parser>().Parameters("optimization").Set("default-optimization").Lifestyle.Transient();
            pandora.Service<int>("default-optimization").Instance(configuration.Optimization);

            pandora.Service<ILessEngine>().Implementor<ParameterDecorator>().Lifestyle.Transient();

            if (configuration.CacheEnabled)
                pandora.Service<ILessEngine>().Implementor<CacheDecorator>().Lifestyle.Transient();

            pandora.Service<ILessEngine>().Implementor<LessEngine>().Parameters("compress").Set("minify-output").Lifestyle.Transient();
            pandora.Service<bool>("minify-output").Instance(configuration.MinifyOutput);

            pandora.Service<ILessEngine>().Implementor<LessEngine>().Parameters("plugins").Set("default-plugins").Lifestyle.Transient();
            pandora.Service<IEnumerable<IPluginConfigurator>>("default-plugins").Instance(configuration.Plugins);

            pandora.Service<IFileReader>().Implementor(configuration.LessSource);
        }
开发者ID:Bounder,项目名称:dotless,代码行数:31,代码来源:ContainerFactory.cs


示例5: CreateContainer

        /// <summary>
        /// Used to create the Container for the HttpHandler. Not used by Console Compiler and T4CSS
        /// </summary>
        /// <param name="configuration">Configuration for the HttpHandler</param>
        /// <returns></returns>
        private PandoraContainer CreateContainer(DotlessConfiguration configuration)
        {
            var container = new PandoraContainer();
            container.Register(p =>
                                   {
                                       p.Service<ILessSource>()
                                           .Implementor(configuration.LessSource);
                                       p.Service<ICache>()
                                           .Implementor<CssCache>();
                                       p.Service<IRequest>()
                                           .Implementor<Request>();

                                       if (!configuration.CacheEnabled)
                                       {
                                           p.Service<IResponse>()
                                               .Implementor<CssResponse>();
                                       }
                                       else
                                       {
                                           p.Service<IResponse>()
                                               .Implementor<CachedCssResponse>();
                                           p.Service<ILessEngine>()
                                               .Implementor<AspCacheDecorator>();
                                       }
                                   });

            return RegisterCoreServices(container, configuration);
        }
开发者ID:gjunge,项目名称:nLess,代码行数:33,代码来源:ContainerFactory.cs


示例6: RegisterServices

        private void RegisterServices(FluentRegistration pandora, DotlessConfiguration configuration)
        {
            OverrideServices(pandora, configuration);

            RegisterLocalServices(pandora);

            RegisterCoreServices(pandora, configuration);
        }
开发者ID:ryansroberts,项目名称:cassette,代码行数:8,代码来源:ContainerFactory.cs


示例7: GetContainer

        public IServiceLocator GetContainer(DotlessConfiguration configuration)
        {
            Container = new PandoraContainer();

            Container.Register(pandora => RegisterServices(pandora, configuration));

            return new CommonServiceLocatorAdapter(Container);
        }
开发者ID:Woriworiwa,项目名称:dotless,代码行数:8,代码来源:ContainerFactory.cs


示例8: RegisterServices

        protected override void RegisterServices(FluentRegistration pandora, DotlessConfiguration configuration)
        {
            base.RegisterServices(pandora, configuration);

            RegisterParameterSource(pandora, configuration);

            RegisterWebServices(pandora, configuration);
        }
开发者ID:Ralphvanderneut,项目名称:dotless,代码行数:8,代码来源:AspNetContainerFactory.cs


示例9: Parse

 public static string Parse(string less, DotlessConfiguration config)
 {
     if (config.Web)
     {
         throw new Exception("Please use dotless.Core.LessWeb.Parse for web applications. This makes sure all web features are available.");
     }
     return new EngineFactory(config).GetEngine().TransformToCss(less, null);
 }
开发者ID:Ralphvanderneut,项目名称:dotless,代码行数:8,代码来源:Less.cs


示例10: IfMinifyOptionSetEngineIsLessEngine

        public void IfMinifyOptionSetEngineIsLessEngine()
        {
            var config = new DotlessConfiguration { MinifyOutput = true, CacheEnabled = false };

            var engine = GetEngine(config);

            Assert.That(engine, Is.TypeOf<LessEngine>());
        }
开发者ID:Ralphvanderneut,项目名称:dotless,代码行数:8,代码来源:ConfigurationFixture.cs


示例11: RegisterServices

        protected virtual void RegisterServices(FluentRegistration pandora, DotlessConfiguration configuration)
        {
            OverrideServices(pandora, configuration);

            if (!configuration.Web)
                RegisterLocalServices(pandora);

            RegisterCoreServices(pandora, configuration);
        }
开发者ID:helephant,项目名称:dotless,代码行数:9,代码来源:ContainerFactory.cs


示例12: IfCacheOptionSetCacheIsInMemoryCache

        public void IfCacheOptionSetCacheIsInMemoryCache()
        {
            var config = new DotlessConfiguration { Web = false, CacheEnabled = true };

            var serviceLocator = new ContainerFactory().GetContainer(config);

            var cache = serviceLocator.GetInstance<ICache>();

            Assert.That(cache, Is.TypeOf<InMemoryCache>());
        }
开发者ID:Ralphvanderneut,项目名称:dotless,代码行数:10,代码来源:ConfigurationFixture.cs


示例13: CompilerConfiguration

        public CompilerConfiguration(DotlessConfiguration config)
        {
            LessSource = config.LessSource;
            LogLevel = config.LogLevel;
            MinifyOutput = config.MinifyOutput;
            Optimization = config.Optimization;

            CacheEnabled = false;
            Web = false;
        }
开发者ID:NickCraver,项目名称:dotless,代码行数:10,代码来源:CompilerConfiguration.cs


示例14: CanPassCustomLogger

        public void CanPassCustomLogger()
        {
            var config = new DotlessConfiguration { Logger = typeof(DummyLogger) };

            var serviceLocator = new ContainerFactory().GetContainer(config);

            var logger = serviceLocator.GetInstance<ILogger>();

            Assert.That(logger, Is.TypeOf<DummyLogger>());
        }
开发者ID:jamesfoster,项目名称:dotless,代码行数:10,代码来源:ConfigurationFixture.cs


示例15: CanOverrideOptimization

        public void CanOverrideOptimization()
        {
            var config = new DotlessConfiguration { Optimization = 7 };

            var serviceLocator = new ContainerFactory().GetContainer(config);

            var parser = serviceLocator.GetInstance<Parser>();

            Assert.That(parser.Tokenizer.Optimization, Is.EqualTo(7));
        }
开发者ID:jamesfoster,项目名称:dotless,代码行数:10,代码来源:ConfigurationFixture.cs


示例16: CanPassCustomLessSource

        public void CanPassCustomLessSource()
        {
            var config = new DotlessConfiguration { LessSource = typeof(DummyFileReader) };

            var serviceLocator = new ContainerFactory().GetContainer(config);

            var source = serviceLocator.GetInstance<IFileReader>();

            Assert.That(source, Is.TypeOf<DummyFileReader>());
        }
开发者ID:jamesfoster,项目名称:dotless,代码行数:10,代码来源:ConfigurationFixture.cs


示例17: CanOverrideLogLevel

        public void CanOverrideLogLevel()
        {
            var config = new DotlessConfiguration { LogLevel = LogLevel.Info };

            var serviceLocator = new ContainerFactory().GetContainer(config);

            var logger = serviceLocator.GetInstance<ILogger>();

            Assert.That(logger, Is.TypeOf<ConsoleLogger>());

            var consoleLogger = (ConsoleLogger)logger;

            Assert.That(consoleLogger.Level, Is.EqualTo(LogLevel.Info));
        }
开发者ID:jamesfoster,项目名称:dotless,代码行数:14,代码来源:ConfigurationFixture.cs


示例18: RegisterCoreServices

 private PandoraContainer RegisterCoreServices(PandoraContainer container, DotlessConfiguration configuration)
 {
     container.Register(p =>
                            {
                                if (configuration.MinifyOutput)
                                {
                                    p.Service<ILessEngine>()
                                        .Implementor<MinifierDecorator>();
                                }
                                p.Service<ILessEngine>()
                                    .Implementor<ExtensibleEngine>();
                                p.Service<ILessSource>()
                                    .Implementor<FileSource>();
                            });
     return container;
 }
开发者ID:jongalloway,项目名称:nLess,代码行数:16,代码来源:ContainerFactory.cs


示例19: CachedCssResponseInstanceIsTransient

        public void CachedCssResponseInstanceIsTransient()
        {
            var config = new DotlessConfiguration { Web = true };

            var serviceLocator = new ContainerFactory().GetContainer(config);

            var response1 = serviceLocator.GetInstance<IResponse>();
            var response2 = serviceLocator.GetInstance<IResponse>();

            Assert.That(response1, Is.Not.SameAs(response2));

            var http1 = (response1 as CachedCssResponse).Http;
            var http2 = (response2 as CachedCssResponse).Http;

            Assert.That(http1, Is.Not.SameAs(http2));
        }
开发者ID:rmariuzzo,项目名称:dotless,代码行数:16,代码来源:ConfigurationFixture.cs


示例20: RegisterWebServices

        private void RegisterWebServices(FluentRegistration pandora, DotlessConfiguration configuration)
        {
            pandora.Service<IHttp>().Implementor<Http>().Lifestyle.Transient();
            pandora.Service<HandlerImpl>().Implementor<HandlerImpl>().Lifestyle.Transient();
            pandora.Service<IParameterSource>().Implementor<QueryStringParameterSource>().Lifestyle.Transient();

            if (configuration.CacheEnabled)
                pandora.Service<IResponse>().Implementor<CachedCssResponse>().Lifestyle.Transient();
            else
                pandora.Service<IResponse>().Implementor<CssResponse>().Lifestyle.Transient();

            pandora.Service<ICache>().Implementor<HttpCache>().Lifestyle.Transient();
            pandora.Service<ILogger>().Implementor<AspResponseLogger>().Parameters("level").Set("error-level").Lifestyle.Transient();

            if (configuration.MapPathsToWeb)
                pandora.Service<IPathResolver>().Implementor<AspServerPathResolver>().Lifestyle.Transient();
            else
                pandora.Service<IPathResolver>().Implementor<AspRelativePathResolver>().Lifestyle.Transient();
        }
开发者ID:Bounder,项目名称:dotless,代码行数:19,代码来源:AspNetContainerFactory.cs



注:本文中的DotlessConfiguration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Double类代码示例发布时间:2022-05-24
下一篇:
C# DotNetProjectConfiguration类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap