public DataCatalog(
     IDictionaryFactory dictionaryFactory)
 {
     _assemblies    = new HashSet <string>();
     _types         = new HashSet <Type>();
     _registrations = dictionaryFactory.Create <Type, SupplierRegistration[]>();
 }
Exemple #2
0
        public PageLayout(
            PageElementDependencies dependencies,
            PageElement parent,
            ILayout layout,
            IEnumerable <Tuple <string, IRegion, IElement> > regionElements,
            IPageData pageData)
            : base(dependencies, parent, layout, pageData)
        {
            pageData.BeginAddElement(Element);

            _regions = dependencies.DictionaryFactory.Create <string, PageRegion>();

            var regionElementList = regionElements == null
                ? new List <Tuple <string, IRegion, IElement> >()
                : regionElements.ToList();

            foreach (var regionName in layout.GetRegionNames())
            {
                var name          = regionName;
                var regionElement = regionElementList.FirstOrDefault(
                    re => string.Equals(re.Item1, name, StringComparison.OrdinalIgnoreCase));

                var region = regionElement == null?layout.GetRegion(name) : regionElement.Item2;

                var element = regionElement == null?layout.GetElement(name) : regionElement.Item3;

                var pageRegion = new PageRegion(dependencies, this, region, element, pageData);
                _regions[regionName] = pageRegion;
            }

            Children = _regions.Values.ToArray();

            pageData.EndAddElement(Element);
        }
Exemple #3
0
        public Layout(ILayoutDependenciesFactory dependencies)
            : base(dependencies.DataConsumerFactory)
        {
            // DO NOT change the method signature of this constructor as
            // this would break all layouts in all applications that use
            // this framework!!

            RegionsByZoneName  = dependencies.DictionaryFactory.Create <string, IRegion>(StringComparer.InvariantCultureIgnoreCase);
            ElementsByZoneName = dependencies.DictionaryFactory.Create <string, IElement>(StringComparer.InvariantCultureIgnoreCase);
        }
Exemple #4
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 RenderContext(
     IAssetManager assetManager,
     IHtmlWriter htmlWriter,
     IDictionaryFactory dictionaryFactory,
     IStringBuilderFactory stringBuilderFactory,
     Action <IOwinContext, Func <string> > trace)
 {
     _assetManager         = assetManager;
     _stringBuilderFactory = stringBuilderFactory;
     _trace        = trace;
     _dataContexts = dictionaryFactory.Create <int, IDataContext>();
     Html          = htmlWriter;
 }
Exemple #6
0
        public ArrayFactory(IQueueFactory queueFactory)
        {
            _queueFactory = queueFactory;

            // Define standard array sizes, this increases chances of reuse
            _arraySizes    = new long[40];
            _arraySizes[0] = 32;
            for (var i = 1; i < _arraySizes.Length; i++)
            {
                _arraySizes[i] = _arraySizes[i - 1] * 2;
            }
            _pools = new ThreadSafeDictionary <Type, object>();
        }
Exemple #7
0
 public StatementFactory()
 {
     MaxPreparedStatementsThreshold = 500;
     _statementCache = new CopyOnWriteDictionary <CacheKey, Task <PreparedStatement> >();
 }
Exemple #8
0
 public Mapper(IFactory defaultFactory, IErrorReporter errorReporter)
 {
     _defaultFactory  = defaultFactory;
     _errorReporter   = errorReporter;
     _typeDefinitions = new ThreadSafeDictionary <string, TypeDefinition>();
 }