//--------------------------------------------------------------------- public void UpateRecord(String name, Int32 age) { ReflectInsight ri = RILogManager.Get("DataAccess"); using (ri.TraceMethod(MethodBase.GetCurrentMethod(), true)) { try { ri.SendMsg("I'm somewhere inside the DataAccess.UpateRecord method"); ri.SendNote("name: {0}", name); ri.SendNote("age: {0}", age); if (age <= 0) { throw new Exception("Invalid age. Age must be greater than 0 (zero)"); } using (DataSet ds = new DataSet()) { ds.ReadXml(String.Format(@"{0}{1}", AppDomain.CurrentDomain.BaseDirectory, "dataset.xml"), XmlReadMode.Auto); ri.SendDataSet("DataSet with 4 tables", ds); ri.SendDataTable("Showing only one table (the last one)", ds.Tables[ds.Tables.Count - 1]); } using (var db = new NorthwindContext()) { var orders = (from order in db.Orders select order).ToList(); var details = (from order_details in db.Order_Details select order_details).ToList(); ri.SendEnumerable("EF Dataset", new IEnumerable[] { orders, details }); } } catch (Exception ex) { ri.SendException(ex); throw; } } }
static void RunSample() { ReflectInsight ri = new ReflectInsight(); while (true) { Console.WriteLine("Press any key to run test or press 'q' to quit..."); ConsoleKeyInfo k = Console.ReadKey(); if (k.KeyChar == 'q') { break; } ri.SendMsg("Message"); ri.SendDebug("Debug"); ri.SendTrace("Trace"); ri.SendInformation("Information"); ri.SendWarning("Warning"); ri.SendError("Error"); ri.SendFatal("Fatal"); ri.SendException("Exception", new Exception("Look at inner exception for more details", new Exception("Some major exception occurred"))); ri.Send(ReflectSoftware.Insight.Common.MessageType.SendError, "Error with details", "These are the details of this error"); ri.Send(ReflectSoftware.Insight.Common.MessageType.SendTrace, "Trace with details", "These are the details of this trace"); using (DataSet DataSet1 = new DataSet()) { DataSet1.ReadXml(String.Format(@"{0}Samples\dataset.xml", AppDomain.CurrentDomain.BaseDirectory), XmlReadMode.Auto); ri.SendDataTable("Data Table", DataSet1.Tables[3]); } ri.SendImage("Hello, World", String.Format(@"{0}Samples\earth.jpg", AppDomain.CurrentDomain.BaseDirectory)); ri.SendStream("Some Stream", String.Format(@"{0}Samples\Earth.jpg", AppDomain.CurrentDomain.BaseDirectory)); } }