示例#1
0
 /// <summary>
 /// Remove password from connection string to make it more safe to display.
 /// </summary>
 /// <param name="connectionString"></param>
 /// <param name="replaceWith"></param>
 /// <returns></returns>
 public static string Safe(string connectionString, string replaceWith)
 {
     Energy.Base.ConnectionString _ = connectionString;
     if (null != _.Password)
     {
         _.Password = replaceWith;
     }
     return(_.ToString());
 }
示例#2
0
        public static void UseEvents(Connection connection)
        {
            connection.OnCreate += Connection_OnCreate;
            connection.OnOpen   += Connection_OnOpen;
            connection.OnClose  += Connection_OnClose;

            connection.ThreadEvent = true;

            Energy.Base.ConnectionString cs = new Energy.Base.ConnectionString(connection.ConnectionString);
            Console.WriteLine(cs.ToDsnString());

            string scalarString1 = connection.Scalar <string>("SELECT GETDATE()");

            connection.ThreadEvent = false;

            string scalarString2 = connection.Scalar <string>("SELECT GETDATE()");
        }