Esempio n. 1
0
        public AssetManager(
            IRequestRouter requestRouter,
            IFrameworkConfiguration frameworkConfiguration,
            ICssWriterFactory cssWriterFactory,
            IJavascriptWriterFactory javascriptWriterFactory,
            IStringBuilderFactory stringBuilderFactory,
            IDictionaryFactory dictionaryFactory)
        {
            _frameworkConfiguration  = frameworkConfiguration;
            _cssWriterFactory        = cssWriterFactory;
            _javascriptWriterFactory = javascriptWriterFactory;
            _stringBuilderFactory    = stringBuilderFactory;

            _elementsAddedToWebsite = new HashSet <string>();
            _elementsAddedToModule  = dictionaryFactory.Create <string, HashSet <string> >();
            _elementsAddedToPage    = dictionaryFactory.Create <string, HashSet <string> >();

            _moduleStyles    = dictionaryFactory.Create <string, string>();
            _moduleFunctions = dictionaryFactory.Create <string, string>();
            _pageStyles      = dictionaryFactory.Create <string, string>();
            _pageFunctions   = dictionaryFactory.Create <string, string>();

            _websiteStylesBuilder    = stringBuilderFactory.Create();
            _websiteFunctionsBuilder = stringBuilderFactory.Create();

            _moduleStyleBuilders    = dictionaryFactory.Create <string, IStringBuilder>();
            _moduleFunctionBuilders = dictionaryFactory.Create <string, IStringBuilder>();
            _pageStyleBuilders      = dictionaryFactory.Create <string, IStringBuilder>();
            _pageFunctionBuilders   = dictionaryFactory.Create <string, IStringBuilder>();

            frameworkConfiguration.Subscribe(config =>
            {
                var rootPath = config.AssetRootPath;
                if (rootPath.EndsWith("/") && rootPath.Length > 1)
                {
                    rootPath = rootPath.Substring(0, rootPath.Length - 1);
                }
                _rootPath = new PathString(rootPath);

                var priorRegistration = _runableRegistration;

                _runableRegistration = requestRouter.Register(this,
                                                              new FilterAllFilters(
                                                                  new FilterByMethod(Method.Get),
                                                                  new FilterByPath(_rootPath.Value + "/**")), -10);

                if (priorRegistration != null)
                {
                    priorRegistration.Dispose();
                }
            });
        }
        public FluentBuilder(
            INameManager nameManager,
            IDataCatalog dataCatalog,
            IDataDependencyFactory dataDependencyFactory,
            IDataSupplierFactory dataSupplierFactory,
            IFrameworkConfiguration frameworkConfiguration)
        {
            _nameManager           = nameManager;
            _dataCatalog           = dataCatalog;
            _dataDependencyFactory = dataDependencyFactory;
            _dataSupplierFactory   = dataSupplierFactory;
            _assemblies            = new HashSet <string>();
            _types = new HashSet <Type>();

            frameworkConfiguration.Subscribe(config => _debugLogging = config.DebugLogging);
        }
Esempio n. 3
0
        public TemplatesPackage(
            IFrameworkConfiguration frameworkConfiguration,
            IHostingEnvironment hostingEnvironment,
            IComponentDependenciesFactory componentDependencies)
        {
            Name          = "templates";
            NamespaceName = "templates";

            _resourceManager          = new ResourceManager(hostingEnvironment, new MimeTypeEvaluator());
            _templateLibraryComponent = new TemplateLibraryComponent(componentDependencies);

            frameworkConfiguration.Subscribe(c =>
            {
                _servicePath = c.ServicesRootPath + "/templates";
                _templateLibraryComponent.Configure(
                    NamespaceName,
                    _servicePath + "/template?path=");
            });
        }
Esempio n. 4
0
        public NameManager(
            IFrameworkConfiguration frameworkConfiguration)
        {
            _pendingActions = new List <PendingActionBase>();

            _components    = new Dictionary <string, IComponent>(StringComparer.InvariantCultureIgnoreCase);
            _regions       = new Dictionary <string, IRegion>(StringComparer.InvariantCultureIgnoreCase);
            _layouts       = new Dictionary <string, ILayout>(StringComparer.InvariantCultureIgnoreCase);
            _pages         = new Dictionary <string, IPage>(StringComparer.InvariantCultureIgnoreCase);
            _services      = new Dictionary <string, IService>(StringComparer.InvariantCultureIgnoreCase);
            _modules       = new Dictionary <string, IModule>(StringComparer.InvariantCultureIgnoreCase);
            _packages      = new Dictionary <string, IPackage>(StringComparer.InvariantCultureIgnoreCase);
            _dataProviders = new Dictionary <string, IDataProvider>(StringComparer.InvariantCultureIgnoreCase);
            _templates     = new Dictionary <string, ITemplate>(StringComparer.InvariantCultureIgnoreCase);

            _assetNames = new Dictionary <string, HashSet <string> >(StringComparer.InvariantCultureIgnoreCase);

            _pendingElementRegistrations      = new List <IElement>();
            _pendingDataProviderRegistrations = new List <IDataProvider>();
            _pendingRunableRegistrations      = new List <IRunable>();

            _random = new Random();
            frameworkConfiguration.Subscribe(config => _debugLogging = config.DebugLogging);
        }