Inheritance: IConfigurationSectionHandler
コード例 #1
0
ファイル: Container.cs プロジェクト: 1508/JsMinifier
        public static void Create(JsMinifierConfiguration config)
        {
            var builder = new ContainerBuilder();
            builder.RegisterType<TraceLogger>().As<ILogger>();
            builder.RegisterType<Http.Http>().As<Http.IHttp>();
            builder.RegisterType<Engine.IncludeExcludeEngineFactory>().As<Engine.IEngineFactory>();

            builder.RegisterType<FileResolver.AbsolutePathResolver>().As<FileResolver.IFileResolver>();
            if (config.Cache)
            {
                builder.RegisterType<Response.CachedResponse>().As<Response.IResponse>()
                .WithParameter(new NamedParameter("isCompressionHandledByResponse", true));
                builder.RegisterType<MinifyEngineWithCache>().As<IMinifyEngine>();
                builder.RegisterType<PlainEngineWithCache>().As<IPlainEngine>();
            }
            else
            {
                builder.RegisterType<Response.NonCachedResponse>().As<Response.IResponse>()
                    .WithParameter(new NamedParameter("isCompressionHandledByResponse", true));
                builder.RegisterType<MinifyEngine>().As<IMinifyEngine>();
                builder.RegisterType<PlainEngine>().As<IPlainEngine>();
            }

            builder.RegisterType<Cache.AspCache>().As<Cache.ICache>();
            builder.RegisterType<Reader.Reader>().As<Reader.IReader>();
            builder.RegisterInstance(config).As<Configuration.JsMinifierConfiguration>();
            builder.RegisterType<JsMinifier>();
            Instance = builder.Build();
        }
コード例 #2
0
 public IncludeExcludeEngineFactory(IPlainEngine plainEngine, Engine.Minify.IMinifyEngine minifyEngine, Http.IHttp http, Configuration.JsMinifierConfiguration configuration)
 {
     _plainEngine = plainEngine;
     _minifyEngine = minifyEngine;
     _http = http;
     _configuration = configuration;
 }
コード例 #3
0
 public static JsMinifierConfiguration GetDefault()
 {
     var jsMinifierConfiguration = new JsMinifierConfiguration();
     jsMinifierConfiguration.Cache = true;
     return jsMinifierConfiguration;
 }