Ejemplo n.º 1
0
        public long ClearPropBagMappersCache()
        {
            // TODO: Clear the request que as well.

            foreach (IPropBagMapperRequestKeyGen mapperRequest in _requests)
            {
                if (mapperRequest is IDisposable disable)
                {
                    disable.Dispose();
                }
            }

            _requests.Clear();

            long result = _propBagMappers.Count;

            foreach (IPropBagMapperGen mapper in _propBagMappers)
            {
                if (mapper is IDisposable disable)
                {
                    disable.Dispose();
                }
            }

            _propBagMappers.Clear();

            return(result);
        }
Ejemplo n.º 2
0
        public long ClearTypeCache()
        {
            long result = _emittedTypes.Count;

            _emittedTypes.Clear();
            return(result);
        }
Ejemplo n.º 3
0
        public long ClearTypeCache()
        {
            long result = _typeDescriptions.Count;

            _typeDescriptions.Clear();
            return(result);
        }
Ejemplo n.º 4
0
        private bool disposedValue = false; // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    // Dispose managed state (managed objects).
                    _cache.Clear();
                }

                // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
                // TODO: set large fields to null.

                disposedValue = true;
            }
        }
Ejemplo n.º 5
0
        private bool disposedValue = false; // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    // Dispose managed state (managed objects) here.
                }

                // Set large fields to null.

                _cache.Clear();

                disposedValue = true;
            }
        }
Ejemplo n.º 6
0
        // TODO: Need to use a lock here, if one has not already been aquired by GetMapperToUse.
        public IConfigurationProvider SealThis(int cntr)
        {
            System.Diagnostics.Debug.WriteLine($"Creating Profile_{cntr.ToString()}");

            IConfigurationProvider config = _baseConfigBuilder(UseInitialConfigAndConfigureTheMappers);

            // TODO: Handle this
            //config.AssertConfigurationIsValid();

            IMapper compositeMapper = config.CreateMapper();

            ProvisionTheMappers(compositeMapper);

            _unSealedPropBagMappers.Clear();

            return(config);
        }
Ejemplo n.º 7
0
        // Note: Creating a Typed GetRawAutoMapper would only offer a very small benefit.
        // Remember if we create on IMapper, we need to process all pending requests in a single batch.
        // These requests have different values for TSource and TDestination and we would still have to
        // use the 'generic way' for all but the one referenced in this request.
        //public IMapper GetRawAutoMapper<TSource, TDestination>(IAutoMapperRequestKey<TSource, TDestination> mapperRequest) where TDestination : class, IPropBag
        //{
        //    IMapper result = null;

        //    return result;
        //}

        // TODO: Note: only the sealed mappers are counted.
        public long ClearTheAutoMappersCache()
        {
            long result = _sealedAutoMappers.Count;

            foreach (IAutoMapperRequestKeyGen mapperRequest in _sealedAutoMappers)
            {
                if (mapperRequest is IDisposable disable)
                {
                    disable.Dispose();
                }
            }
            _unSealedAutoMappers.Clear();

            foreach (IAutoMapperRequestKeyGen mapper in _sealedAutoMappers)
            {
                if (mapper is IDisposable disable)
                {
                    disable.Dispose();
                }
            }
            _sealedAutoMappers.Clear();

            return(result);
        }