예제 #1
0
        /// <summary>
        /// Ends the current registration process.
        /// </summary>
        /// <returns></returns>
        public static ModelRegistry EndRegistration()
        {
            var completed = _current;

            _current = null;

            Monitor.Exit(_lock);
            return(completed);
        }
예제 #2
0
        /// <summary>
        /// Begins a new registration process.
        /// </summary>
        public static void BeginRegistration()
        {
            if (_current != null)
            {
                throw new InvalidOperationException("An existing registration context is already open.");
            }

            Monitor.Enter(_lock);

            _current             = new ModelRegistry();
            _current._extFactory = new ExtensionFactory();
        }