Exemplo n.º 1
0
 /// <summary>
 /// This method invokes the LoggingContext() that creates a context for database logging
 /// and also invokes DataCenterLog() that creates a table to store log values
 /// </summary>
 /// <param name="args"></param>
 public static void Main(string[] args)
 {
     try
     {
         Console.WriteLine(Constants.ConnectingToSqlServer);
         var database = new LoggingContext();
         var dblog    = new DataCenterLog();
         database.logs.Add(dblog);
         Console.WriteLine(Constants.SuccessfulConnection);
         Thread.Sleep(2000);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// This method invokes the LoggingContext() that creates a context for database logging
 /// and also invokes DataCenterLog() that creates a table to store log values
 /// </summary>
 /// <param name="args"></param>
 public static void Main(string[] args)
 {
     try
     {
         Console.WriteLine(Constants.ConnectingToSqlServer);
         var database = new LoggingContext();
         var dblog = new DataCenterLog();
         database.logs.Add(dblog);
         Console.WriteLine(Constants.SuccessfulConnection);
         Thread.Sleep(2000);
     }
     catch(Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }