Example #1
0
        /*============================================================================*/
        /* Private Functions                                                          */
        /*============================================================================*/

        private InjectionMapping CreateMapping(MappingId mappingId)
        {
            if (_mappingsInProcess.ContainsKey(mappingId))
            {
                throw new InjectorException("Can't change a mapping from inside a listener to it's creation event");
            }

            _mappingsInProcess [mappingId] = true;

            if (_preMappingCreate != null)
            {
                _preMappingCreate(mappingId);
            }

            InjectionMapping mapping = new InjectionMapping(this, mappingId);

            _mappings [mappingId] = mapping;

            object sealKey = mapping.Seal();

            if (_postMappingCreate != null)
            {
                _postMappingCreate(mappingId, mapping);
            }

            _mappingsInProcess.Remove(mappingId);
            mapping.Unseal(sealKey);
            return(mapping);
        }