Esempio n. 1
0
        /// <summary>
        /// Returns parser wrapper which should be used according to needs
        /// and released (via ParserPool.Release(...))
        /// </summary>
        /// <param name="type">Type of database (Client, Server) you want to connect</param>
        /// <param name="autoOpenConnection">if true - ParserPool returns open connection parser, closed parser otherwise</param>
        /// <returns></returns>
        public static ParserDisposableWrapper Acquire(Database type, bool autoOpenConnection = true)
        {
            ParserDisposableWrapper wrapper = new ParserDisposableWrapper(new Parser(type));

            if (autoOpenConnection)
            {
                wrapper.Instance.Open();
            }

            return(wrapper);
        }
Esempio n. 2
0
 /// <summary>
 /// Receives not-needed-anymore parser (as a wrapper), handles db connection close if not closed
 /// </summary>
 /// <param name="wrapper"></param>
 public static void Release(ParserDisposableWrapper wrapper)
 {
     Release(wrapper.Instance);
 }