Esempio n. 1
0
        public static void RunDemo(string explanation, Func <dynamic, dynamic> dbQuery, string pocoType, bool isEager)
        {
            try
            {
                ShowExplanation(explanation);

                var listener = new ExampleTraceListener();
                Trace.Listeners.Add(listener);

                dynamic db      = Database.Open();
                dynamic results = dbQuery(db);
                ListReturnedProperties(results, pocoType, isEager);

                ShowSql(listener);

                Trace.Listeners.Remove(listener);
            }
            catch (Exception ex)
            {
                ShowException(ex);
            }

            Console.WriteLine("Press return");
            Console.ReadLine();
        }
Esempio n. 2
0
 private static void ShowSql(ExampleTraceListener listener)
 {
     Console.WriteLine("--------");
     Console.ForegroundColor = ConsoleColor.Green;
     Console.WriteLine("SQL Sent to database was:");
     Console.WriteLine(listener.Output);
     Console.ResetColor();
 }