コード例 #1
0
        private IProjectionManager GetManager(IProjectionEntry entry)
        {
            Contract.Requires(entry != null);

            var projectionType = entry.ProjectionType;

            // check for preinitialized projection manager
            var manager = entry.ProjectionManager;

            if (manager == null)
            {
                // lock cache for concurrency
                lock (_managers)
                {
                    // find manager in cache
                    manager = GetCachedManager(projectionType);

                    // if manager is not cached, create and cache
                    if (manager == null)
                    {
                        manager = CreateManager(entry.ProjectionManagerType);

                        CacheManager(projectionType, manager);
                    }
                }
            }

            return(manager);
        }
        public IProjectionCatalog Add(IProjectionEntry entry)
        {
            Contract.Requires(entry != null);
            Contract.Ensures(Contract.Result <IProjectionCatalog>() != null);
            Contract.Ensures(GetEntry(entry.ProjectionType) == entry);
            Contract.EnsuresOnThrow <ArgumentException>(GetEntry(entry.ProjectionType) == Contract.OldValue(GetEntry(entry.ProjectionType)));

            throw new NotImplementedException();
        }
コード例 #3
0
        public IProjectionCatalog Add(IProjectionEntry entry)
        {
            if (_entries.Any(x => x.ProjectionType == entry.ProjectionType))
            {
                throw new ApplicationException("An item with the same projection type has already been added to the catalog.");
            }

            _entries.Add(entry);
            Contract.Assume(GetEntry(entry.ProjectionType) == entry);

            return(this);
        }