Esempio n. 1
0
        /// <summary>
        /// Returns an instance of <see cref="TDBConnection" />.
        /// <para>
        /// <em>This method is the only way to get an Instance of
        /// <see cref="TDBConnection" /> because the Class is <b>sealed</b>
        /// (therefore not allowing the creation of an Instance of it using a Constructor!)</em>
        /// </para>
        /// </summary>
        /// <remarks>
        /// Before an Instance of <see cref="TDBConnection" /> is created,
        /// a check is performed whether an instance has already been created by
        /// the calling class. If this is the case, then the the same instance is returned,
        /// otherwise a new instance of <see cref="TDBConnection" /> is created and returned.
        /// </remarks>
        /// <returns>An instance of the <see cref="TDBConnection" /> Class.
        /// </returns>
        public static TDBConnection GetInstance()
        {
            // Support multithreaded applications through "Double checked locking"
            // pattern which avoids locking every time the method is invoked.
            if (FSingletonConnector == null)
            {
                FSingletonConnector = new TDBConnection();
            }

            return(FSingletonConnector);
        }
Esempio n. 2
0
        /// <summary>
        /// Returns an instance of <see cref="TDBConnection" />.
        /// <para>
        /// <em>This method is the only way to get an Instance of
        /// <see cref="TDBConnection" /> because the Class is <b>sealed</b>
        /// (therefore not allowing the creation of an Instance of it using a Constructor!)</em>
        /// </para>
        /// </summary>
        /// <remarks>
        /// Before an Instance of <see cref="TDBConnection" /> is created,
        /// a check is performed whether an instance has already been created by
        /// the calling class. If this is the case, then the the same instance is returned,
        /// otherwise a new instance of <see cref="TDBConnection" /> is created and returned.
        /// </remarks>
        /// <returns>An instance of the <see cref="TDBConnection" /> Class.
        /// </returns>
        public static TDBConnection GetInstance()
        {
            // Support multithreaded applications through "Double checked locking"
            // pattern which avoids locking every time the method is invoked.
            if (FSingletonConnector == null)
            {
                FSingletonConnector = new TDBConnection();
            }

            return FSingletonConnector;
        }