[{"data":1,"prerenderedAt":2228},["ShallowReactive",2],{"blog:2008:linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers":3,"blogMore-Development":2035,"comments-linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers":2048},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"category":11,"tags":12,"excerpt":17,"body":32,"_type":2027,"_id":2028,"_source":2029,"_file":2030,"_stem":2031,"_extension":2032,"url":2033,"wordCount":2034,"minutes":275,"commentCount":332},"/blog/2008/linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers","2008",false,"en","LINQ to SQL log to debug window, file, memory or multiple writers","The Log property on a LINQ to SQL data context takes a TextWriter and streams out details of the SQL statements and parameters that are being generated and sent to the server.","2008-07-30T20:36:57+00:00","Development",[13,14,15,16],".NET","C#","LINQ","debugging",{"type":18,"children":19},"root",[20,27],{"type":21,"tag":22,"props":23,"children":24},"element","p",{},[25],{"type":26,"value":9},"text",{"type":21,"tag":22,"props":28,"children":29},{},[30],{"type":26,"value":31},"Normally in examples you will see Console.Out being assigned to it which is fine for small demos and sandboxes but sooner or later you’ll want access to it in Windows or web applications. Here are some examples of how to redirect TextWriter output such as the DataContext log to other destinations.",{"type":18,"children":33,"toc":2020},[34,38,42,62,69,74,470,475,514,520,642,647,653,752,757,763,768,1372,1377,1535,1541,1546,1936,1941,2000,2005,2014],{"type":21,"tag":22,"props":35,"children":36},{},[37],{"type":26,"value":9},{"type":21,"tag":22,"props":39,"children":40},{},[41],{"type":26,"value":31},{"type":21,"tag":43,"props":44,"children":45},"blockquote",{},[46],{"type":21,"tag":22,"props":47,"children":48},{},[49,51,60],{"type":26,"value":50},"GitHub has the ",{"type":21,"tag":52,"props":53,"children":57},"a",{"href":54,"rel":55},"https://github.com/damieng/DamienGKit/tree/master/CSharp/DamienG.Library/IO",[56],"nofollow",[58],{"type":26,"value":59},"latest version of ActionTextWriter",{"type":26,"value":61}," etc.",{"type":21,"tag":63,"props":64,"children":66},"h2",{"id":65},"to-the-outputdebug-window",[67],{"type":26,"value":68},"To the output/debug window",{"type":21,"tag":22,"props":70,"children":71},{},[72],{"type":26,"value":73},"The output/debug window mechanism actually uses a listener mechanism and so doesn’t actually directly expose a TextWriter interface however we can simply wrap up Debug.Write in something that does and use that instead:",{"type":21,"tag":75,"props":76,"children":81},"pre",{"className":77,"code":78,"language":79,"meta":80,"style":80},"language-csharp shiki shiki-themes everforest-light dracula","class DebugTextWriter : System.IO.TextWriter {\n   public override void Write(char[] buffer, int index, int count) {\n       System.Diagnostics.Debug.Write(new String(buffer, index, count));\n   }\n\n   public override void Write(string value) {\n       System.Diagnostics.Debug.Write(value);\n   }\n\n   public override Encoding Encoding {\n       get { return System.Text.Encoding.Default; }\n   }\n}\n","csharp","",[82],{"type":21,"tag":83,"props":84,"children":85},"code",{"__ignoreMap":80},[86,140,221,273,282,292,330,363,371,379,401,453,461],{"type":21,"tag":87,"props":88,"children":91},"span",{"class":89,"line":90},"line",1,[92,98,104,110,116,121,126,130,135],{"type":21,"tag":87,"props":93,"children":95},{"style":94},"--shiki-default:#F85552;--shiki-dark:#FF79C6",[96],{"type":26,"value":97},"class",{"type":21,"tag":87,"props":99,"children":101},{"style":100},"--shiki-default:#3A94C5;--shiki-dark:#8BE9FD",[102],{"type":26,"value":103}," DebugTextWriter",{"type":21,"tag":87,"props":105,"children":107},{"style":106},"--shiki-default:#5C6A72;--shiki-dark:#F8F8F2",[108],{"type":26,"value":109}," : ",{"type":21,"tag":87,"props":111,"children":113},{"style":112},"--shiki-default:#3A94C5;--shiki-default-font-style:inherit;--shiki-dark:#8BE9FD;--shiki-dark-font-style:italic",[114],{"type":26,"value":115},"System",{"type":21,"tag":87,"props":117,"children":118},{"style":106},[119],{"type":26,"value":120},".",{"type":21,"tag":87,"props":122,"children":123},{"style":112},[124],{"type":26,"value":125},"IO",{"type":21,"tag":87,"props":127,"children":128},{"style":106},[129],{"type":26,"value":120},{"type":21,"tag":87,"props":131,"children":132},{"style":112},[133],{"type":26,"value":134},"TextWriter",{"type":21,"tag":87,"props":136,"children":137},{"style":106},[138],{"type":26,"value":139}," {\n",{"type":21,"tag":87,"props":141,"children":143},{"class":89,"line":142},2,[144,150,155,161,167,172,177,182,188,193,198,203,207,211,216],{"type":21,"tag":87,"props":145,"children":147},{"style":146},"--shiki-default:#F57D26;--shiki-dark:#FF79C6",[148],{"type":26,"value":149},"   public",{"type":21,"tag":87,"props":151,"children":152},{"style":146},[153],{"type":26,"value":154}," override",{"type":21,"tag":87,"props":156,"children":158},{"style":157},"--shiki-default:#3A94C5;--shiki-dark:#FF79C6",[159],{"type":26,"value":160}," void",{"type":21,"tag":87,"props":162,"children":164},{"style":163},"--shiki-default:#8DA101;--shiki-dark:#50FA7B",[165],{"type":26,"value":166}," Write",{"type":21,"tag":87,"props":168,"children":169},{"style":106},[170],{"type":26,"value":171},"(",{"type":21,"tag":87,"props":173,"children":174},{"style":157},[175],{"type":26,"value":176},"char",{"type":21,"tag":87,"props":178,"children":179},{"style":106},[180],{"type":26,"value":181},"[] ",{"type":21,"tag":87,"props":183,"children":185},{"style":184},"--shiki-default:#5C6A72;--shiki-default-font-style:inherit;--shiki-dark:#FFB86C;--shiki-dark-font-style:italic",[186],{"type":26,"value":187},"buffer",{"type":21,"tag":87,"props":189,"children":190},{"style":106},[191],{"type":26,"value":192},", ",{"type":21,"tag":87,"props":194,"children":195},{"style":157},[196],{"type":26,"value":197},"int",{"type":21,"tag":87,"props":199,"children":200},{"style":184},[201],{"type":26,"value":202}," index",{"type":21,"tag":87,"props":204,"children":205},{"style":106},[206],{"type":26,"value":192},{"type":21,"tag":87,"props":208,"children":209},{"style":157},[210],{"type":26,"value":197},{"type":21,"tag":87,"props":212,"children":213},{"style":184},[214],{"type":26,"value":215}," count",{"type":21,"tag":87,"props":217,"children":218},{"style":106},[219],{"type":26,"value":220},") {\n",{"type":21,"tag":87,"props":222,"children":224},{"class":89,"line":223},3,[225,230,236,240,245,249,254,258,263,268],{"type":21,"tag":87,"props":226,"children":227},{"style":106},[228],{"type":26,"value":229},"       System.",{"type":21,"tag":87,"props":231,"children":233},{"style":232},"--shiki-default:#35A77C;--shiki-dark:#F8F8F2",[234],{"type":26,"value":235},"Diagnostics",{"type":21,"tag":87,"props":237,"children":238},{"style":106},[239],{"type":26,"value":120},{"type":21,"tag":87,"props":241,"children":242},{"style":232},[243],{"type":26,"value":244},"Debug",{"type":21,"tag":87,"props":246,"children":247},{"style":106},[248],{"type":26,"value":120},{"type":21,"tag":87,"props":250,"children":251},{"style":163},[252],{"type":26,"value":253},"Write",{"type":21,"tag":87,"props":255,"children":256},{"style":106},[257],{"type":26,"value":171},{"type":21,"tag":87,"props":259,"children":260},{"style":94},[261],{"type":26,"value":262},"new",{"type":21,"tag":87,"props":264,"children":265},{"style":112},[266],{"type":26,"value":267}," String",{"type":21,"tag":87,"props":269,"children":270},{"style":106},[271],{"type":26,"value":272},"(buffer, index, count));\n",{"type":21,"tag":87,"props":274,"children":276},{"class":89,"line":275},4,[277],{"type":21,"tag":87,"props":278,"children":279},{"style":106},[280],{"type":26,"value":281},"   }\n",{"type":21,"tag":87,"props":283,"children":285},{"class":89,"line":284},5,[286],{"type":21,"tag":87,"props":287,"children":289},{"emptyLinePlaceholder":288},true,[290],{"type":26,"value":291},"\n",{"type":21,"tag":87,"props":293,"children":295},{"class":89,"line":294},6,[296,300,304,308,312,316,321,326],{"type":21,"tag":87,"props":297,"children":298},{"style":146},[299],{"type":26,"value":149},{"type":21,"tag":87,"props":301,"children":302},{"style":146},[303],{"type":26,"value":154},{"type":21,"tag":87,"props":305,"children":306},{"style":157},[307],{"type":26,"value":160},{"type":21,"tag":87,"props":309,"children":310},{"style":163},[311],{"type":26,"value":166},{"type":21,"tag":87,"props":313,"children":314},{"style":106},[315],{"type":26,"value":171},{"type":21,"tag":87,"props":317,"children":318},{"style":157},[319],{"type":26,"value":320},"string",{"type":21,"tag":87,"props":322,"children":323},{"style":184},[324],{"type":26,"value":325}," value",{"type":21,"tag":87,"props":327,"children":328},{"style":106},[329],{"type":26,"value":220},{"type":21,"tag":87,"props":331,"children":333},{"class":89,"line":332},7,[334,338,342,346,350,354,358],{"type":21,"tag":87,"props":335,"children":336},{"style":106},[337],{"type":26,"value":229},{"type":21,"tag":87,"props":339,"children":340},{"style":232},[341],{"type":26,"value":235},{"type":21,"tag":87,"props":343,"children":344},{"style":106},[345],{"type":26,"value":120},{"type":21,"tag":87,"props":347,"children":348},{"style":232},[349],{"type":26,"value":244},{"type":21,"tag":87,"props":351,"children":352},{"style":106},[353],{"type":26,"value":120},{"type":21,"tag":87,"props":355,"children":356},{"style":163},[357],{"type":26,"value":253},{"type":21,"tag":87,"props":359,"children":360},{"style":106},[361],{"type":26,"value":362},"(value);\n",{"type":21,"tag":87,"props":364,"children":366},{"class":89,"line":365},8,[367],{"type":21,"tag":87,"props":368,"children":369},{"style":106},[370],{"type":26,"value":281},{"type":21,"tag":87,"props":372,"children":374},{"class":89,"line":373},9,[375],{"type":21,"tag":87,"props":376,"children":377},{"emptyLinePlaceholder":288},[378],{"type":26,"value":291},{"type":21,"tag":87,"props":380,"children":382},{"class":89,"line":381},10,[383,387,391,396],{"type":21,"tag":87,"props":384,"children":385},{"style":146},[386],{"type":26,"value":149},{"type":21,"tag":87,"props":388,"children":389},{"style":146},[390],{"type":26,"value":154},{"type":21,"tag":87,"props":392,"children":393},{"style":112},[394],{"type":26,"value":395}," Encoding",{"type":21,"tag":87,"props":397,"children":398},{"style":106},[399],{"type":26,"value":400}," Encoding {\n",{"type":21,"tag":87,"props":402,"children":404},{"class":89,"line":403},11,[405,410,415,420,425,430,434,439,443,448],{"type":21,"tag":87,"props":406,"children":407},{"style":157},[408],{"type":26,"value":409},"       get",{"type":21,"tag":87,"props":411,"children":412},{"style":106},[413],{"type":26,"value":414}," { ",{"type":21,"tag":87,"props":416,"children":417},{"style":94},[418],{"type":26,"value":419},"return",{"type":21,"tag":87,"props":421,"children":422},{"style":106},[423],{"type":26,"value":424}," System.",{"type":21,"tag":87,"props":426,"children":427},{"style":232},[428],{"type":26,"value":429},"Text",{"type":21,"tag":87,"props":431,"children":432},{"style":106},[433],{"type":26,"value":120},{"type":21,"tag":87,"props":435,"children":436},{"style":232},[437],{"type":26,"value":438},"Encoding",{"type":21,"tag":87,"props":440,"children":441},{"style":106},[442],{"type":26,"value":120},{"type":21,"tag":87,"props":444,"children":445},{"style":232},[446],{"type":26,"value":447},"Default",{"type":21,"tag":87,"props":449,"children":450},{"style":106},[451],{"type":26,"value":452},"; }\n",{"type":21,"tag":87,"props":454,"children":456},{"class":89,"line":455},12,[457],{"type":21,"tag":87,"props":458,"children":459},{"style":106},[460],{"type":26,"value":281},{"type":21,"tag":87,"props":462,"children":464},{"class":89,"line":463},13,[465],{"type":21,"tag":87,"props":466,"children":467},{"style":106},[468],{"type":26,"value":469},"}\n",{"type":21,"tag":22,"props":471,"children":472},{},[473],{"type":26,"value":474},"To use it then simply:",{"type":21,"tag":75,"props":476,"children":478},{"className":77,"code":477,"language":79,"meta":80,"style":80},"myDataContext.Log = new DebugTextWriter();\n",[479],{"type":21,"tag":83,"props":480,"children":481},{"__ignoreMap":80},[482],{"type":21,"tag":87,"props":483,"children":484},{"class":89,"line":90},[485,490,495,500,505,509],{"type":21,"tag":87,"props":486,"children":487},{"style":106},[488],{"type":26,"value":489},"myDataContext.",{"type":21,"tag":87,"props":491,"children":492},{"style":232},[493],{"type":26,"value":494},"Log",{"type":21,"tag":87,"props":496,"children":497},{"style":146},[498],{"type":26,"value":499}," =",{"type":21,"tag":87,"props":501,"children":502},{"style":94},[503],{"type":26,"value":504}," new",{"type":21,"tag":87,"props":506,"children":507},{"style":112},[508],{"type":26,"value":103},{"type":21,"tag":87,"props":510,"children":511},{"style":106},[512],{"type":26,"value":513},"();\n",{"type":21,"tag":63,"props":515,"children":517},{"id":516},"to-a-file",[518],{"type":26,"value":519},"To a file",{"type":21,"tag":75,"props":521,"children":523},{"className":77,"code":522,"language":79,"meta":80,"style":80},"#if DEBUG\n db.Log = new System.IO.StreamWriter(\"linq-to-sql.log\") { AutoFlush = true };\n#endif\n",[524],{"type":21,"tag":83,"props":525,"children":526},{"__ignoreMap":80},[527,547,630],{"type":21,"tag":87,"props":528,"children":529},{"class":89,"line":90},[530,536,542],{"type":21,"tag":87,"props":531,"children":533},{"style":532},"--shiki-default:#5C6A72;--shiki-dark:#FF79C6",[534],{"type":26,"value":535},"#",{"type":21,"tag":87,"props":537,"children":539},{"style":538},"--shiki-default:#35A77C;--shiki-dark:#FF79C6",[540],{"type":26,"value":541},"if",{"type":21,"tag":87,"props":543,"children":544},{"style":106},[545],{"type":26,"value":546}," DEBUG\n",{"type":21,"tag":87,"props":548,"children":549},{"class":89,"line":142},[550,555,559,563,567,572,576,580,584,589,593,599,605,609,614,619,625],{"type":21,"tag":87,"props":551,"children":552},{"style":106},[553],{"type":26,"value":554}," db.",{"type":21,"tag":87,"props":556,"children":557},{"style":232},[558],{"type":26,"value":494},{"type":21,"tag":87,"props":560,"children":561},{"style":146},[562],{"type":26,"value":499},{"type":21,"tag":87,"props":564,"children":565},{"style":94},[566],{"type":26,"value":504},{"type":21,"tag":87,"props":568,"children":569},{"style":112},[570],{"type":26,"value":571}," System",{"type":21,"tag":87,"props":573,"children":574},{"style":106},[575],{"type":26,"value":120},{"type":21,"tag":87,"props":577,"children":578},{"style":112},[579],{"type":26,"value":125},{"type":21,"tag":87,"props":581,"children":582},{"style":106},[583],{"type":26,"value":120},{"type":21,"tag":87,"props":585,"children":586},{"style":112},[587],{"type":26,"value":588},"StreamWriter",{"type":21,"tag":87,"props":590,"children":591},{"style":106},[592],{"type":26,"value":171},{"type":21,"tag":87,"props":594,"children":596},{"style":595},"--shiki-default:#8DA101;--shiki-dark:#E9F284",[597],{"type":26,"value":598},"\"",{"type":21,"tag":87,"props":600,"children":602},{"style":601},"--shiki-default:#8DA101;--shiki-dark:#F1FA8C",[603],{"type":26,"value":604},"linq-to-sql.log",{"type":21,"tag":87,"props":606,"children":607},{"style":595},[608],{"type":26,"value":598},{"type":21,"tag":87,"props":610,"children":611},{"style":106},[612],{"type":26,"value":613},") { AutoFlush ",{"type":21,"tag":87,"props":615,"children":616},{"style":146},[617],{"type":26,"value":618},"=",{"type":21,"tag":87,"props":620,"children":622},{"style":621},"--shiki-default:#DF69BA;--shiki-dark:#BD93F9",[623],{"type":26,"value":624}," true",{"type":21,"tag":87,"props":626,"children":627},{"style":106},[628],{"type":26,"value":629}," };\n",{"type":21,"tag":87,"props":631,"children":632},{"class":89,"line":223},[633,637],{"type":21,"tag":87,"props":634,"children":635},{"style":532},[636],{"type":26,"value":535},{"type":21,"tag":87,"props":638,"children":639},{"style":538},[640],{"type":26,"value":641},"endif\n",{"type":21,"tag":22,"props":643,"children":644},{},[645],{"type":26,"value":646},"If you wish to not overwrite the existing log file then change the constructor to include the parameter true after the filename. Bear in mind this log file can get very large and slow down your application with all that extra writing to disk and could well reveal information you’d rather wasn’t persisted there so the DEBUG conditional is recommended.",{"type":21,"tag":63,"props":648,"children":650},{"id":649},"to-memory",[651],{"type":26,"value":652},"To memory",{"type":21,"tag":75,"props":654,"children":656},{"className":77,"code":655,"language":79,"meta":80,"style":80},"#if DEBUG\n var sw = new System.IO.StringWriter();\n db.Log = sw;\n#endif\n",[657],{"type":21,"tag":83,"props":658,"children":659},{"__ignoreMap":80},[660,675,721,741],{"type":21,"tag":87,"props":661,"children":662},{"class":89,"line":90},[663,667,671],{"type":21,"tag":87,"props":664,"children":665},{"style":532},[666],{"type":26,"value":535},{"type":21,"tag":87,"props":668,"children":669},{"style":538},[670],{"type":26,"value":541},{"type":21,"tag":87,"props":672,"children":673},{"style":106},[674],{"type":26,"value":546},{"type":21,"tag":87,"props":676,"children":677},{"class":89,"line":142},[678,683,688,692,696,700,704,708,712,717],{"type":21,"tag":87,"props":679,"children":680},{"style":157},[681],{"type":26,"value":682}," var",{"type":21,"tag":87,"props":684,"children":685},{"style":106},[686],{"type":26,"value":687}," sw ",{"type":21,"tag":87,"props":689,"children":690},{"style":146},[691],{"type":26,"value":618},{"type":21,"tag":87,"props":693,"children":694},{"style":94},[695],{"type":26,"value":504},{"type":21,"tag":87,"props":697,"children":698},{"style":112},[699],{"type":26,"value":571},{"type":21,"tag":87,"props":701,"children":702},{"style":106},[703],{"type":26,"value":120},{"type":21,"tag":87,"props":705,"children":706},{"style":112},[707],{"type":26,"value":125},{"type":21,"tag":87,"props":709,"children":710},{"style":106},[711],{"type":26,"value":120},{"type":21,"tag":87,"props":713,"children":714},{"style":112},[715],{"type":26,"value":716},"StringWriter",{"type":21,"tag":87,"props":718,"children":719},{"style":106},[720],{"type":26,"value":513},{"type":21,"tag":87,"props":722,"children":723},{"class":89,"line":223},[724,728,732,736],{"type":21,"tag":87,"props":725,"children":726},{"style":106},[727],{"type":26,"value":554},{"type":21,"tag":87,"props":729,"children":730},{"style":232},[731],{"type":26,"value":494},{"type":21,"tag":87,"props":733,"children":734},{"style":146},[735],{"type":26,"value":499},{"type":21,"tag":87,"props":737,"children":738},{"style":106},[739],{"type":26,"value":740}," sw;\n",{"type":21,"tag":87,"props":742,"children":743},{"class":89,"line":275},[744,748],{"type":21,"tag":87,"props":745,"children":746},{"style":532},[747],{"type":26,"value":535},{"type":21,"tag":87,"props":749,"children":750},{"style":538},[751],{"type":26,"value":641},{"type":21,"tag":22,"props":753,"children":754},{},[755],{"type":26,"value":756},"You will be able to examine sw or call ToString() on it to see the contents. Again this is not recommended for production as it will cause a lot of memory consumption as the StringWriter gets larger and larger.",{"type":21,"tag":63,"props":758,"children":760},{"id":759},"to-multiple-writers",[761],{"type":26,"value":762},"To multiple writers",{"type":21,"tag":22,"props":764,"children":765},{},[766],{"type":26,"value":767},"Here is a small useful class that lets you send the results intended for a TextWriter off into multiple writers.",{"type":21,"tag":75,"props":769,"children":771},{"className":77,"code":770,"language":79,"meta":80,"style":80},"class MulticastTextWriter : TextWriter {\n  private readonly IList\u003CTextWriter> textWriters;\n\n  public MulticastTextWriter() : this(new List\u003CTextWriter>()) {\n  }\n\n  public MulticastTextWriter(IList\u003CTextWriter> textWriters) {\n    this.textWriters = textWriters;\n  }\n\n  public void Add(TextWriter textWriter) {\n    lock (textWriters)\n      textWriters.Add(textWriter);\n  }\n\n  public bool Remove(TextWriter textWriter) {\n    lock (textWriters)\n      return textWriters.Remove(textWriter);\n  }\n\n  public override void Write(char[] buffer, int index, int count) {\n    lock (textWriters)\n      foreach (TextWriter textWriter in textWriters)\n        textWriter.Write(buffer, index, count);\n  }\n\n  public override Encoding Encoding {\n    get { return System.Text.Encoding.Default; }\n  }\n}\n",[772],{"type":21,"tag":83,"props":773,"children":774},{"__ignoreMap":80},[775,799,831,838,887,895,902,944,969,976,983,1016,1029,1047,1055,1063,1097,1109,1132,1140,1148,1212,1224,1257,1275,1283,1291,1311,1356,1364],{"type":21,"tag":87,"props":776,"children":777},{"class":89,"line":90},[778,782,787,791,795],{"type":21,"tag":87,"props":779,"children":780},{"style":94},[781],{"type":26,"value":97},{"type":21,"tag":87,"props":783,"children":784},{"style":100},[785],{"type":26,"value":786}," MulticastTextWriter",{"type":21,"tag":87,"props":788,"children":789},{"style":106},[790],{"type":26,"value":109},{"type":21,"tag":87,"props":792,"children":793},{"style":112},[794],{"type":26,"value":134},{"type":21,"tag":87,"props":796,"children":797},{"style":106},[798],{"type":26,"value":139},{"type":21,"tag":87,"props":800,"children":801},{"class":89,"line":142},[802,807,812,817,822,826],{"type":21,"tag":87,"props":803,"children":804},{"style":146},[805],{"type":26,"value":806},"  private",{"type":21,"tag":87,"props":808,"children":809},{"style":146},[810],{"type":26,"value":811}," readonly",{"type":21,"tag":87,"props":813,"children":814},{"style":112},[815],{"type":26,"value":816}," IList",{"type":21,"tag":87,"props":818,"children":819},{"style":106},[820],{"type":26,"value":821},"\u003C",{"type":21,"tag":87,"props":823,"children":824},{"style":112},[825],{"type":26,"value":134},{"type":21,"tag":87,"props":827,"children":828},{"style":106},[829],{"type":26,"value":830},"> textWriters;\n",{"type":21,"tag":87,"props":832,"children":833},{"class":89,"line":223},[834],{"type":21,"tag":87,"props":835,"children":836},{"emptyLinePlaceholder":288},[837],{"type":26,"value":291},{"type":21,"tag":87,"props":839,"children":840},{"class":89,"line":275},[841,846,850,855,861,865,869,874,878,882],{"type":21,"tag":87,"props":842,"children":843},{"style":146},[844],{"type":26,"value":845},"  public",{"type":21,"tag":87,"props":847,"children":848},{"style":163},[849],{"type":26,"value":786},{"type":21,"tag":87,"props":851,"children":852},{"style":106},[853],{"type":26,"value":854},"() : ",{"type":21,"tag":87,"props":856,"children":858},{"style":857},"--shiki-default:#DF69BA;--shiki-default-font-style:inherit;--shiki-dark:#BD93F9;--shiki-dark-font-style:italic",[859],{"type":26,"value":860},"this",{"type":21,"tag":87,"props":862,"children":863},{"style":106},[864],{"type":26,"value":171},{"type":21,"tag":87,"props":866,"children":867},{"style":94},[868],{"type":26,"value":262},{"type":21,"tag":87,"props":870,"children":871},{"style":112},[872],{"type":26,"value":873}," List",{"type":21,"tag":87,"props":875,"children":876},{"style":106},[877],{"type":26,"value":821},{"type":21,"tag":87,"props":879,"children":880},{"style":112},[881],{"type":26,"value":134},{"type":21,"tag":87,"props":883,"children":884},{"style":106},[885],{"type":26,"value":886},">()) {\n",{"type":21,"tag":87,"props":888,"children":889},{"class":89,"line":284},[890],{"type":21,"tag":87,"props":891,"children":892},{"style":106},[893],{"type":26,"value":894},"  }\n",{"type":21,"tag":87,"props":896,"children":897},{"class":89,"line":294},[898],{"type":21,"tag":87,"props":899,"children":900},{"emptyLinePlaceholder":288},[901],{"type":26,"value":291},{"type":21,"tag":87,"props":903,"children":904},{"class":89,"line":332},[905,909,913,917,922,926,930,935,940],{"type":21,"tag":87,"props":906,"children":907},{"style":146},[908],{"type":26,"value":845},{"type":21,"tag":87,"props":910,"children":911},{"style":163},[912],{"type":26,"value":786},{"type":21,"tag":87,"props":914,"children":915},{"style":106},[916],{"type":26,"value":171},{"type":21,"tag":87,"props":918,"children":919},{"style":112},[920],{"type":26,"value":921},"IList",{"type":21,"tag":87,"props":923,"children":924},{"style":106},[925],{"type":26,"value":821},{"type":21,"tag":87,"props":927,"children":928},{"style":112},[929],{"type":26,"value":134},{"type":21,"tag":87,"props":931,"children":932},{"style":106},[933],{"type":26,"value":934},"> ",{"type":21,"tag":87,"props":936,"children":937},{"style":184},[938],{"type":26,"value":939},"textWriters",{"type":21,"tag":87,"props":941,"children":942},{"style":106},[943],{"type":26,"value":220},{"type":21,"tag":87,"props":945,"children":946},{"class":89,"line":365},[947,952,956,960,964],{"type":21,"tag":87,"props":948,"children":949},{"style":857},[950],{"type":26,"value":951},"    this",{"type":21,"tag":87,"props":953,"children":954},{"style":106},[955],{"type":26,"value":120},{"type":21,"tag":87,"props":957,"children":958},{"style":232},[959],{"type":26,"value":939},{"type":21,"tag":87,"props":961,"children":962},{"style":146},[963],{"type":26,"value":499},{"type":21,"tag":87,"props":965,"children":966},{"style":106},[967],{"type":26,"value":968}," textWriters;\n",{"type":21,"tag":87,"props":970,"children":971},{"class":89,"line":373},[972],{"type":21,"tag":87,"props":973,"children":974},{"style":106},[975],{"type":26,"value":894},{"type":21,"tag":87,"props":977,"children":978},{"class":89,"line":381},[979],{"type":21,"tag":87,"props":980,"children":981},{"emptyLinePlaceholder":288},[982],{"type":26,"value":291},{"type":21,"tag":87,"props":984,"children":985},{"class":89,"line":403},[986,990,994,999,1003,1007,1012],{"type":21,"tag":87,"props":987,"children":988},{"style":146},[989],{"type":26,"value":845},{"type":21,"tag":87,"props":991,"children":992},{"style":157},[993],{"type":26,"value":160},{"type":21,"tag":87,"props":995,"children":996},{"style":163},[997],{"type":26,"value":998}," Add",{"type":21,"tag":87,"props":1000,"children":1001},{"style":106},[1002],{"type":26,"value":171},{"type":21,"tag":87,"props":1004,"children":1005},{"style":112},[1006],{"type":26,"value":134},{"type":21,"tag":87,"props":1008,"children":1009},{"style":184},[1010],{"type":26,"value":1011}," textWriter",{"type":21,"tag":87,"props":1013,"children":1014},{"style":106},[1015],{"type":26,"value":220},{"type":21,"tag":87,"props":1017,"children":1018},{"class":89,"line":455},[1019,1024],{"type":21,"tag":87,"props":1020,"children":1021},{"style":94},[1022],{"type":26,"value":1023},"    lock",{"type":21,"tag":87,"props":1025,"children":1026},{"style":106},[1027],{"type":26,"value":1028}," (textWriters)\n",{"type":21,"tag":87,"props":1030,"children":1031},{"class":89,"line":463},[1032,1037,1042],{"type":21,"tag":87,"props":1033,"children":1034},{"style":106},[1035],{"type":26,"value":1036},"      textWriters.",{"type":21,"tag":87,"props":1038,"children":1039},{"style":163},[1040],{"type":26,"value":1041},"Add",{"type":21,"tag":87,"props":1043,"children":1044},{"style":106},[1045],{"type":26,"value":1046},"(textWriter);\n",{"type":21,"tag":87,"props":1048,"children":1050},{"class":89,"line":1049},14,[1051],{"type":21,"tag":87,"props":1052,"children":1053},{"style":106},[1054],{"type":26,"value":894},{"type":21,"tag":87,"props":1056,"children":1058},{"class":89,"line":1057},15,[1059],{"type":21,"tag":87,"props":1060,"children":1061},{"emptyLinePlaceholder":288},[1062],{"type":26,"value":291},{"type":21,"tag":87,"props":1064,"children":1066},{"class":89,"line":1065},16,[1067,1071,1076,1081,1085,1089,1093],{"type":21,"tag":87,"props":1068,"children":1069},{"style":146},[1070],{"type":26,"value":845},{"type":21,"tag":87,"props":1072,"children":1073},{"style":157},[1074],{"type":26,"value":1075}," bool",{"type":21,"tag":87,"props":1077,"children":1078},{"style":163},[1079],{"type":26,"value":1080}," Remove",{"type":21,"tag":87,"props":1082,"children":1083},{"style":106},[1084],{"type":26,"value":171},{"type":21,"tag":87,"props":1086,"children":1087},{"style":112},[1088],{"type":26,"value":134},{"type":21,"tag":87,"props":1090,"children":1091},{"style":184},[1092],{"type":26,"value":1011},{"type":21,"tag":87,"props":1094,"children":1095},{"style":106},[1096],{"type":26,"value":220},{"type":21,"tag":87,"props":1098,"children":1100},{"class":89,"line":1099},17,[1101,1105],{"type":21,"tag":87,"props":1102,"children":1103},{"style":94},[1104],{"type":26,"value":1023},{"type":21,"tag":87,"props":1106,"children":1107},{"style":106},[1108],{"type":26,"value":1028},{"type":21,"tag":87,"props":1110,"children":1112},{"class":89,"line":1111},18,[1113,1118,1123,1128],{"type":21,"tag":87,"props":1114,"children":1115},{"style":94},[1116],{"type":26,"value":1117},"      return",{"type":21,"tag":87,"props":1119,"children":1120},{"style":106},[1121],{"type":26,"value":1122}," textWriters.",{"type":21,"tag":87,"props":1124,"children":1125},{"style":163},[1126],{"type":26,"value":1127},"Remove",{"type":21,"tag":87,"props":1129,"children":1130},{"style":106},[1131],{"type":26,"value":1046},{"type":21,"tag":87,"props":1133,"children":1135},{"class":89,"line":1134},19,[1136],{"type":21,"tag":87,"props":1137,"children":1138},{"style":106},[1139],{"type":26,"value":894},{"type":21,"tag":87,"props":1141,"children":1143},{"class":89,"line":1142},20,[1144],{"type":21,"tag":87,"props":1145,"children":1146},{"emptyLinePlaceholder":288},[1147],{"type":26,"value":291},{"type":21,"tag":87,"props":1149,"children":1151},{"class":89,"line":1150},21,[1152,1156,1160,1164,1168,1172,1176,1180,1184,1188,1192,1196,1200,1204,1208],{"type":21,"tag":87,"props":1153,"children":1154},{"style":146},[1155],{"type":26,"value":845},{"type":21,"tag":87,"props":1157,"children":1158},{"style":146},[1159],{"type":26,"value":154},{"type":21,"tag":87,"props":1161,"children":1162},{"style":157},[1163],{"type":26,"value":160},{"type":21,"tag":87,"props":1165,"children":1166},{"style":163},[1167],{"type":26,"value":166},{"type":21,"tag":87,"props":1169,"children":1170},{"style":106},[1171],{"type":26,"value":171},{"type":21,"tag":87,"props":1173,"children":1174},{"style":157},[1175],{"type":26,"value":176},{"type":21,"tag":87,"props":1177,"children":1178},{"style":106},[1179],{"type":26,"value":181},{"type":21,"tag":87,"props":1181,"children":1182},{"style":184},[1183],{"type":26,"value":187},{"type":21,"tag":87,"props":1185,"children":1186},{"style":106},[1187],{"type":26,"value":192},{"type":21,"tag":87,"props":1189,"children":1190},{"style":157},[1191],{"type":26,"value":197},{"type":21,"tag":87,"props":1193,"children":1194},{"style":184},[1195],{"type":26,"value":202},{"type":21,"tag":87,"props":1197,"children":1198},{"style":106},[1199],{"type":26,"value":192},{"type":21,"tag":87,"props":1201,"children":1202},{"style":157},[1203],{"type":26,"value":197},{"type":21,"tag":87,"props":1205,"children":1206},{"style":184},[1207],{"type":26,"value":215},{"type":21,"tag":87,"props":1209,"children":1210},{"style":106},[1211],{"type":26,"value":220},{"type":21,"tag":87,"props":1213,"children":1215},{"class":89,"line":1214},22,[1216,1220],{"type":21,"tag":87,"props":1217,"children":1218},{"style":94},[1219],{"type":26,"value":1023},{"type":21,"tag":87,"props":1221,"children":1222},{"style":106},[1223],{"type":26,"value":1028},{"type":21,"tag":87,"props":1225,"children":1227},{"class":89,"line":1226},23,[1228,1233,1238,1242,1247,1252],{"type":21,"tag":87,"props":1229,"children":1230},{"style":94},[1231],{"type":26,"value":1232},"      foreach",{"type":21,"tag":87,"props":1234,"children":1235},{"style":106},[1236],{"type":26,"value":1237}," (",{"type":21,"tag":87,"props":1239,"children":1240},{"style":112},[1241],{"type":26,"value":134},{"type":21,"tag":87,"props":1243,"children":1244},{"style":106},[1245],{"type":26,"value":1246}," textWriter ",{"type":21,"tag":87,"props":1248,"children":1249},{"style":94},[1250],{"type":26,"value":1251},"in",{"type":21,"tag":87,"props":1253,"children":1254},{"style":106},[1255],{"type":26,"value":1256}," textWriters)\n",{"type":21,"tag":87,"props":1258,"children":1260},{"class":89,"line":1259},24,[1261,1266,1270],{"type":21,"tag":87,"props":1262,"children":1263},{"style":106},[1264],{"type":26,"value":1265},"        textWriter.",{"type":21,"tag":87,"props":1267,"children":1268},{"style":163},[1269],{"type":26,"value":253},{"type":21,"tag":87,"props":1271,"children":1272},{"style":106},[1273],{"type":26,"value":1274},"(buffer, index, count);\n",{"type":21,"tag":87,"props":1276,"children":1278},{"class":89,"line":1277},25,[1279],{"type":21,"tag":87,"props":1280,"children":1281},{"style":106},[1282],{"type":26,"value":894},{"type":21,"tag":87,"props":1284,"children":1286},{"class":89,"line":1285},26,[1287],{"type":21,"tag":87,"props":1288,"children":1289},{"emptyLinePlaceholder":288},[1290],{"type":26,"value":291},{"type":21,"tag":87,"props":1292,"children":1294},{"class":89,"line":1293},27,[1295,1299,1303,1307],{"type":21,"tag":87,"props":1296,"children":1297},{"style":146},[1298],{"type":26,"value":845},{"type":21,"tag":87,"props":1300,"children":1301},{"style":146},[1302],{"type":26,"value":154},{"type":21,"tag":87,"props":1304,"children":1305},{"style":112},[1306],{"type":26,"value":395},{"type":21,"tag":87,"props":1308,"children":1309},{"style":106},[1310],{"type":26,"value":400},{"type":21,"tag":87,"props":1312,"children":1314},{"class":89,"line":1313},28,[1315,1320,1324,1328,1332,1336,1340,1344,1348,1352],{"type":21,"tag":87,"props":1316,"children":1317},{"style":157},[1318],{"type":26,"value":1319},"    get",{"type":21,"tag":87,"props":1321,"children":1322},{"style":106},[1323],{"type":26,"value":414},{"type":21,"tag":87,"props":1325,"children":1326},{"style":94},[1327],{"type":26,"value":419},{"type":21,"tag":87,"props":1329,"children":1330},{"style":106},[1331],{"type":26,"value":424},{"type":21,"tag":87,"props":1333,"children":1334},{"style":232},[1335],{"type":26,"value":429},{"type":21,"tag":87,"props":1337,"children":1338},{"style":106},[1339],{"type":26,"value":120},{"type":21,"tag":87,"props":1341,"children":1342},{"style":232},[1343],{"type":26,"value":438},{"type":21,"tag":87,"props":1345,"children":1346},{"style":106},[1347],{"type":26,"value":120},{"type":21,"tag":87,"props":1349,"children":1350},{"style":232},[1351],{"type":26,"value":447},{"type":21,"tag":87,"props":1353,"children":1354},{"style":106},[1355],{"type":26,"value":452},{"type":21,"tag":87,"props":1357,"children":1359},{"class":89,"line":1358},29,[1360],{"type":21,"tag":87,"props":1361,"children":1362},{"style":106},[1363],{"type":26,"value":894},{"type":21,"tag":87,"props":1365,"children":1367},{"class":89,"line":1366},30,[1368],{"type":21,"tag":87,"props":1369,"children":1370},{"style":106},[1371],{"type":26,"value":469},{"type":21,"tag":22,"props":1373,"children":1374},{},[1375],{"type":26,"value":1376},"So if you wanted to output to a log and also to the debug window, you would use it like this (again recommended only for debugging):",{"type":21,"tag":75,"props":1378,"children":1380},{"className":77,"code":1379,"language":79,"meta":80,"style":80},"var mw = new MulticastTextWriter();\nmw.Add(new DebugTextWriter());\nmw.Add(new System.IO.StreamWriter(\"linq-to-sql.log\") { AutoFlush = true });\ndb.Log = mw;\n",[1381],{"type":21,"tag":83,"props":1382,"children":1383},{"__ignoreMap":80},[1384,1413,1442,1514],{"type":21,"tag":87,"props":1385,"children":1386},{"class":89,"line":90},[1387,1392,1397,1401,1405,1409],{"type":21,"tag":87,"props":1388,"children":1389},{"style":157},[1390],{"type":26,"value":1391},"var",{"type":21,"tag":87,"props":1393,"children":1394},{"style":106},[1395],{"type":26,"value":1396}," mw ",{"type":21,"tag":87,"props":1398,"children":1399},{"style":146},[1400],{"type":26,"value":618},{"type":21,"tag":87,"props":1402,"children":1403},{"style":94},[1404],{"type":26,"value":504},{"type":21,"tag":87,"props":1406,"children":1407},{"style":112},[1408],{"type":26,"value":786},{"type":21,"tag":87,"props":1410,"children":1411},{"style":106},[1412],{"type":26,"value":513},{"type":21,"tag":87,"props":1414,"children":1415},{"class":89,"line":142},[1416,1421,1425,1429,1433,1437],{"type":21,"tag":87,"props":1417,"children":1418},{"style":106},[1419],{"type":26,"value":1420},"mw.",{"type":21,"tag":87,"props":1422,"children":1423},{"style":163},[1424],{"type":26,"value":1041},{"type":21,"tag":87,"props":1426,"children":1427},{"style":106},[1428],{"type":26,"value":171},{"type":21,"tag":87,"props":1430,"children":1431},{"style":94},[1432],{"type":26,"value":262},{"type":21,"tag":87,"props":1434,"children":1435},{"style":112},[1436],{"type":26,"value":103},{"type":21,"tag":87,"props":1438,"children":1439},{"style":106},[1440],{"type":26,"value":1441},"());\n",{"type":21,"tag":87,"props":1443,"children":1444},{"class":89,"line":223},[1445,1449,1453,1457,1461,1465,1469,1473,1477,1481,1485,1489,1493,1497,1501,1505,1509],{"type":21,"tag":87,"props":1446,"children":1447},{"style":106},[1448],{"type":26,"value":1420},{"type":21,"tag":87,"props":1450,"children":1451},{"style":163},[1452],{"type":26,"value":1041},{"type":21,"tag":87,"props":1454,"children":1455},{"style":106},[1456],{"type":26,"value":171},{"type":21,"tag":87,"props":1458,"children":1459},{"style":94},[1460],{"type":26,"value":262},{"type":21,"tag":87,"props":1462,"children":1463},{"style":112},[1464],{"type":26,"value":571},{"type":21,"tag":87,"props":1466,"children":1467},{"style":106},[1468],{"type":26,"value":120},{"type":21,"tag":87,"props":1470,"children":1471},{"style":112},[1472],{"type":26,"value":125},{"type":21,"tag":87,"props":1474,"children":1475},{"style":106},[1476],{"type":26,"value":120},{"type":21,"tag":87,"props":1478,"children":1479},{"style":112},[1480],{"type":26,"value":588},{"type":21,"tag":87,"props":1482,"children":1483},{"style":106},[1484],{"type":26,"value":171},{"type":21,"tag":87,"props":1486,"children":1487},{"style":595},[1488],{"type":26,"value":598},{"type":21,"tag":87,"props":1490,"children":1491},{"style":601},[1492],{"type":26,"value":604},{"type":21,"tag":87,"props":1494,"children":1495},{"style":595},[1496],{"type":26,"value":598},{"type":21,"tag":87,"props":1498,"children":1499},{"style":106},[1500],{"type":26,"value":613},{"type":21,"tag":87,"props":1502,"children":1503},{"style":146},[1504],{"type":26,"value":618},{"type":21,"tag":87,"props":1506,"children":1507},{"style":621},[1508],{"type":26,"value":624},{"type":21,"tag":87,"props":1510,"children":1511},{"style":106},[1512],{"type":26,"value":1513}," });\n",{"type":21,"tag":87,"props":1515,"children":1516},{"class":89,"line":275},[1517,1522,1526,1530],{"type":21,"tag":87,"props":1518,"children":1519},{"style":106},[1520],{"type":26,"value":1521},"db.",{"type":21,"tag":87,"props":1523,"children":1524},{"style":232},[1525],{"type":26,"value":494},{"type":21,"tag":87,"props":1527,"children":1528},{"style":146},[1529],{"type":26,"value":499},{"type":21,"tag":87,"props":1531,"children":1532},{"style":106},[1533],{"type":26,"value":1534}," mw;\n",{"type":21,"tag":63,"props":1536,"children":1538},{"id":1537},"anything-you-want",[1539],{"type":26,"value":1540},"Anything you want",{"type":21,"tag":22,"props":1542,"children":1543},{},[1544],{"type":26,"value":1545},"To wrap things up here is a small TextWriter that lets you go off and do whatever you like with the string via the Action delegate.",{"type":21,"tag":75,"props":1547,"children":1549},{"className":77,"code":1548,"language":79,"meta":80,"style":80},"class ActionTextWriter : TextWriter {\n  private readonly Action\u003Cstring> action;\n\n  public ActionTextWriter(Action\u003Cstring> action) {\n    this.action = action;\n  }\n\n  public override void Write(char[] buffer, int index, int count) {\n    Write(new string(buffer, index, count));\n  }\n\n  public override void Write(string value) {\n    action.Invoke(value);\n  }\n\n  public override Encoding Encoding {\n    get { return System.Text.Encoding.Default; }\n  }\n}\n",[1550],{"type":21,"tag":83,"props":1551,"children":1552},{"__ignoreMap":80},[1553,1577,1606,1613,1654,1678,1685,1692,1755,1780,1787,1794,1829,1846,1853,1860,1879,1922,1929],{"type":21,"tag":87,"props":1554,"children":1555},{"class":89,"line":90},[1556,1560,1565,1569,1573],{"type":21,"tag":87,"props":1557,"children":1558},{"style":94},[1559],{"type":26,"value":97},{"type":21,"tag":87,"props":1561,"children":1562},{"style":100},[1563],{"type":26,"value":1564}," ActionTextWriter",{"type":21,"tag":87,"props":1566,"children":1567},{"style":106},[1568],{"type":26,"value":109},{"type":21,"tag":87,"props":1570,"children":1571},{"style":112},[1572],{"type":26,"value":134},{"type":21,"tag":87,"props":1574,"children":1575},{"style":106},[1576],{"type":26,"value":139},{"type":21,"tag":87,"props":1578,"children":1579},{"class":89,"line":142},[1580,1584,1588,1593,1597,1601],{"type":21,"tag":87,"props":1581,"children":1582},{"style":146},[1583],{"type":26,"value":806},{"type":21,"tag":87,"props":1585,"children":1586},{"style":146},[1587],{"type":26,"value":811},{"type":21,"tag":87,"props":1589,"children":1590},{"style":112},[1591],{"type":26,"value":1592}," Action",{"type":21,"tag":87,"props":1594,"children":1595},{"style":106},[1596],{"type":26,"value":821},{"type":21,"tag":87,"props":1598,"children":1599},{"style":157},[1600],{"type":26,"value":320},{"type":21,"tag":87,"props":1602,"children":1603},{"style":106},[1604],{"type":26,"value":1605},"> action;\n",{"type":21,"tag":87,"props":1607,"children":1608},{"class":89,"line":223},[1609],{"type":21,"tag":87,"props":1610,"children":1611},{"emptyLinePlaceholder":288},[1612],{"type":26,"value":291},{"type":21,"tag":87,"props":1614,"children":1615},{"class":89,"line":275},[1616,1620,1624,1628,1633,1637,1641,1645,1650],{"type":21,"tag":87,"props":1617,"children":1618},{"style":146},[1619],{"type":26,"value":845},{"type":21,"tag":87,"props":1621,"children":1622},{"style":163},[1623],{"type":26,"value":1564},{"type":21,"tag":87,"props":1625,"children":1626},{"style":106},[1627],{"type":26,"value":171},{"type":21,"tag":87,"props":1629,"children":1630},{"style":112},[1631],{"type":26,"value":1632},"Action",{"type":21,"tag":87,"props":1634,"children":1635},{"style":106},[1636],{"type":26,"value":821},{"type":21,"tag":87,"props":1638,"children":1639},{"style":157},[1640],{"type":26,"value":320},{"type":21,"tag":87,"props":1642,"children":1643},{"style":106},[1644],{"type":26,"value":934},{"type":21,"tag":87,"props":1646,"children":1647},{"style":184},[1648],{"type":26,"value":1649},"action",{"type":21,"tag":87,"props":1651,"children":1652},{"style":106},[1653],{"type":26,"value":220},{"type":21,"tag":87,"props":1655,"children":1656},{"class":89,"line":284},[1657,1661,1665,1669,1673],{"type":21,"tag":87,"props":1658,"children":1659},{"style":857},[1660],{"type":26,"value":951},{"type":21,"tag":87,"props":1662,"children":1663},{"style":106},[1664],{"type":26,"value":120},{"type":21,"tag":87,"props":1666,"children":1667},{"style":232},[1668],{"type":26,"value":1649},{"type":21,"tag":87,"props":1670,"children":1671},{"style":146},[1672],{"type":26,"value":499},{"type":21,"tag":87,"props":1674,"children":1675},{"style":106},[1676],{"type":26,"value":1677}," action;\n",{"type":21,"tag":87,"props":1679,"children":1680},{"class":89,"line":294},[1681],{"type":21,"tag":87,"props":1682,"children":1683},{"style":106},[1684],{"type":26,"value":894},{"type":21,"tag":87,"props":1686,"children":1687},{"class":89,"line":332},[1688],{"type":21,"tag":87,"props":1689,"children":1690},{"emptyLinePlaceholder":288},[1691],{"type":26,"value":291},{"type":21,"tag":87,"props":1693,"children":1694},{"class":89,"line":365},[1695,1699,1703,1707,1711,1715,1719,1723,1727,1731,1735,1739,1743,1747,1751],{"type":21,"tag":87,"props":1696,"children":1697},{"style":146},[1698],{"type":26,"value":845},{"type":21,"tag":87,"props":1700,"children":1701},{"style":146},[1702],{"type":26,"value":154},{"type":21,"tag":87,"props":1704,"children":1705},{"style":157},[1706],{"type":26,"value":160},{"type":21,"tag":87,"props":1708,"children":1709},{"style":163},[1710],{"type":26,"value":166},{"type":21,"tag":87,"props":1712,"children":1713},{"style":106},[1714],{"type":26,"value":171},{"type":21,"tag":87,"props":1716,"children":1717},{"style":157},[1718],{"type":26,"value":176},{"type":21,"tag":87,"props":1720,"children":1721},{"style":106},[1722],{"type":26,"value":181},{"type":21,"tag":87,"props":1724,"children":1725},{"style":184},[1726],{"type":26,"value":187},{"type":21,"tag":87,"props":1728,"children":1729},{"style":106},[1730],{"type":26,"value":192},{"type":21,"tag":87,"props":1732,"children":1733},{"style":157},[1734],{"type":26,"value":197},{"type":21,"tag":87,"props":1736,"children":1737},{"style":184},[1738],{"type":26,"value":202},{"type":21,"tag":87,"props":1740,"children":1741},{"style":106},[1742],{"type":26,"value":192},{"type":21,"tag":87,"props":1744,"children":1745},{"style":157},[1746],{"type":26,"value":197},{"type":21,"tag":87,"props":1748,"children":1749},{"style":184},[1750],{"type":26,"value":215},{"type":21,"tag":87,"props":1752,"children":1753},{"style":106},[1754],{"type":26,"value":220},{"type":21,"tag":87,"props":1756,"children":1757},{"class":89,"line":373},[1758,1763,1767,1771,1776],{"type":21,"tag":87,"props":1759,"children":1760},{"style":163},[1761],{"type":26,"value":1762},"    Write",{"type":21,"tag":87,"props":1764,"children":1765},{"style":106},[1766],{"type":26,"value":171},{"type":21,"tag":87,"props":1768,"children":1769},{"style":94},[1770],{"type":26,"value":262},{"type":21,"tag":87,"props":1772,"children":1773},{"style":157},[1774],{"type":26,"value":1775}," string",{"type":21,"tag":87,"props":1777,"children":1778},{"style":106},[1779],{"type":26,"value":272},{"type":21,"tag":87,"props":1781,"children":1782},{"class":89,"line":381},[1783],{"type":21,"tag":87,"props":1784,"children":1785},{"style":106},[1786],{"type":26,"value":894},{"type":21,"tag":87,"props":1788,"children":1789},{"class":89,"line":403},[1790],{"type":21,"tag":87,"props":1791,"children":1792},{"emptyLinePlaceholder":288},[1793],{"type":26,"value":291},{"type":21,"tag":87,"props":1795,"children":1796},{"class":89,"line":455},[1797,1801,1805,1809,1813,1817,1821,1825],{"type":21,"tag":87,"props":1798,"children":1799},{"style":146},[1800],{"type":26,"value":845},{"type":21,"tag":87,"props":1802,"children":1803},{"style":146},[1804],{"type":26,"value":154},{"type":21,"tag":87,"props":1806,"children":1807},{"style":157},[1808],{"type":26,"value":160},{"type":21,"tag":87,"props":1810,"children":1811},{"style":163},[1812],{"type":26,"value":166},{"type":21,"tag":87,"props":1814,"children":1815},{"style":106},[1816],{"type":26,"value":171},{"type":21,"tag":87,"props":1818,"children":1819},{"style":157},[1820],{"type":26,"value":320},{"type":21,"tag":87,"props":1822,"children":1823},{"style":184},[1824],{"type":26,"value":325},{"type":21,"tag":87,"props":1826,"children":1827},{"style":106},[1828],{"type":26,"value":220},{"type":21,"tag":87,"props":1830,"children":1831},{"class":89,"line":463},[1832,1837,1842],{"type":21,"tag":87,"props":1833,"children":1834},{"style":106},[1835],{"type":26,"value":1836},"    action.",{"type":21,"tag":87,"props":1838,"children":1839},{"style":163},[1840],{"type":26,"value":1841},"Invoke",{"type":21,"tag":87,"props":1843,"children":1844},{"style":106},[1845],{"type":26,"value":362},{"type":21,"tag":87,"props":1847,"children":1848},{"class":89,"line":1049},[1849],{"type":21,"tag":87,"props":1850,"children":1851},{"style":106},[1852],{"type":26,"value":894},{"type":21,"tag":87,"props":1854,"children":1855},{"class":89,"line":1057},[1856],{"type":21,"tag":87,"props":1857,"children":1858},{"emptyLinePlaceholder":288},[1859],{"type":26,"value":291},{"type":21,"tag":87,"props":1861,"children":1862},{"class":89,"line":1065},[1863,1867,1871,1875],{"type":21,"tag":87,"props":1864,"children":1865},{"style":146},[1866],{"type":26,"value":845},{"type":21,"tag":87,"props":1868,"children":1869},{"style":146},[1870],{"type":26,"value":154},{"type":21,"tag":87,"props":1872,"children":1873},{"style":112},[1874],{"type":26,"value":395},{"type":21,"tag":87,"props":1876,"children":1877},{"style":106},[1878],{"type":26,"value":400},{"type":21,"tag":87,"props":1880,"children":1881},{"class":89,"line":1099},[1882,1886,1890,1894,1898,1902,1906,1910,1914,1918],{"type":21,"tag":87,"props":1883,"children":1884},{"style":157},[1885],{"type":26,"value":1319},{"type":21,"tag":87,"props":1887,"children":1888},{"style":106},[1889],{"type":26,"value":414},{"type":21,"tag":87,"props":1891,"children":1892},{"style":94},[1893],{"type":26,"value":419},{"type":21,"tag":87,"props":1895,"children":1896},{"style":106},[1897],{"type":26,"value":424},{"type":21,"tag":87,"props":1899,"children":1900},{"style":232},[1901],{"type":26,"value":429},{"type":21,"tag":87,"props":1903,"children":1904},{"style":106},[1905],{"type":26,"value":120},{"type":21,"tag":87,"props":1907,"children":1908},{"style":232},[1909],{"type":26,"value":438},{"type":21,"tag":87,"props":1911,"children":1912},{"style":106},[1913],{"type":26,"value":120},{"type":21,"tag":87,"props":1915,"children":1916},{"style":232},[1917],{"type":26,"value":447},{"type":21,"tag":87,"props":1919,"children":1920},{"style":106},[1921],{"type":26,"value":452},{"type":21,"tag":87,"props":1923,"children":1924},{"class":89,"line":1111},[1925],{"type":21,"tag":87,"props":1926,"children":1927},{"style":106},[1928],{"type":26,"value":894},{"type":21,"tag":87,"props":1930,"children":1931},{"class":89,"line":1134},[1932],{"type":21,"tag":87,"props":1933,"children":1934},{"style":106},[1935],{"type":26,"value":469},{"type":21,"tag":22,"props":1937,"children":1938},{},[1939],{"type":26,"value":1940},"So if you wanted to output all log information to say a WinForms message box a tiny lambda expression gets you there:",{"type":21,"tag":75,"props":1942,"children":1944},{"className":77,"code":1943,"language":79,"meta":80,"style":80},"db.Log = new ActionTextWriter(s => MessageBox.Show(s));\n",[1945],{"type":21,"tag":83,"props":1946,"children":1947},{"__ignoreMap":80},[1948],{"type":21,"tag":87,"props":1949,"children":1950},{"class":89,"line":90},[1951,1955,1959,1963,1967,1971,1975,1980,1985,1990,1995],{"type":21,"tag":87,"props":1952,"children":1953},{"style":106},[1954],{"type":26,"value":1521},{"type":21,"tag":87,"props":1956,"children":1957},{"style":232},[1958],{"type":26,"value":494},{"type":21,"tag":87,"props":1960,"children":1961},{"style":146},[1962],{"type":26,"value":499},{"type":21,"tag":87,"props":1964,"children":1965},{"style":94},[1966],{"type":26,"value":504},{"type":21,"tag":87,"props":1968,"children":1969},{"style":112},[1970],{"type":26,"value":1564},{"type":21,"tag":87,"props":1972,"children":1973},{"style":106},[1974],{"type":26,"value":171},{"type":21,"tag":87,"props":1976,"children":1977},{"style":184},[1978],{"type":26,"value":1979},"s",{"type":21,"tag":87,"props":1981,"children":1982},{"style":146},[1983],{"type":26,"value":1984}," =>",{"type":21,"tag":87,"props":1986,"children":1987},{"style":106},[1988],{"type":26,"value":1989}," MessageBox.",{"type":21,"tag":87,"props":1991,"children":1992},{"style":163},[1993],{"type":26,"value":1994},"Show",{"type":21,"tag":87,"props":1996,"children":1997},{"style":106},[1998],{"type":26,"value":1999},"(s));\n",{"type":21,"tag":22,"props":2001,"children":2002},{},[2003],{"type":26,"value":2004},"Have fun!",{"type":21,"tag":22,"props":2006,"children":2007},{},[2008],{"type":21,"tag":2009,"props":2010,"children":2011},"em",{},[2012],{"type":26,"value":2013},"[)amien",{"type":21,"tag":2015,"props":2016,"children":2017},"style",{},[2018],{"type":26,"value":2019},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":80,"searchDepth":142,"depth":142,"links":2021},[2022,2023,2024,2025,2026],{"id":65,"depth":142,"text":68},{"id":516,"depth":142,"text":519},{"id":649,"depth":142,"text":652},{"id":759,"depth":142,"text":762},{"id":1537,"depth":142,"text":1540},"markdown","content:blog:2008:linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers.md","content","blog/2008/linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers.md","blog/2008/linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers","md","/blog/2008/linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers/",756,[2036,2040,2044],{"title":2037,"date":2038,"url":2039},"HTML5 Video Cheatsheet: Optimizing videos for the web","2025-12-05T00:00:00Z","/blog/2025/html5-video-cheatsheet/",{"title":2041,"date":2042,"url":2043},"Transactions in the MongoDB EF Core Provider","2025-10-25","/blog/2025/mongodb-explicit-transactions/",{"title":2045,"date":2046,"url":2047},"Queryable Encryption with the MongoDB EF Core Provider","2025-09-22","/blog/2025/mongodb-queryable-encryption/",[2049,2071,2101,2133,2158,2188,2208],{"_path":2050,"_dir":2051,"_draft":6,"_partial":6,"_locale":7,"title":2052,"description":2053,"id":2054,"name":2055,"email":2056,"avatar":2057,"url":2058,"date":2059,"body":2060,"_type":2027,"_id":2068,"_source":2029,"_file":2069,"_stem":2070,"_extension":2032},"/comments/linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers/151947","linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers","151947","It will not. There should be no harm in leaving it there but the easiest way to turn off entirely would be to put #if DEBUG  #endif around the line that connects it to what it is logging.",151947,"Damien Guard","damien@envytech.co.uk","https://www.gravatar.com/avatar/dc72963e7279d34c85ed4c0b731ce5a9?r=pg&d=retro","https://damieng.com/","2015-10-09T10:01:31",{"type":18,"children":2061,"toc":2066},[2062],{"type":21,"tag":22,"props":2063,"children":2064},{},[2065],{"type":26,"value":2053},{"title":80,"searchDepth":142,"depth":142,"links":2067},[],"content:comments:linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers:151947.md","comments/linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers/151947.md","comments/linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers/151947",{"_path":2072,"_dir":2051,"_draft":6,"_partial":6,"_locale":7,"title":2073,"description":2074,"id":2075,"name":2076,"email":2077,"avatar":2078,"url":2079,"date":2080,"body":2081,"_type":2027,"_id":2098,"_source":2029,"_file":2099,"_stem":2100,"_extension":2032},"/comments/linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers/151925","151925","Fantastic! Love it. Question though, if you happen to know, will the DebugWriter basically get compiled away in release mode?",151925,"Rubberduck","ckuhn203@gmail.com","https://www.gravatar.com/avatar/0b43c27212304872e59ec6c73e1e30e7?r=pg&d=retro","https://christopherjmcclellan.wordpress.com/","2015-10-09T07:30:04",{"type":18,"children":2082,"toc":2096},[2083],{"type":21,"tag":22,"props":2084,"children":2085},{},[2086,2088,2094],{"type":26,"value":2087},"Fantastic! Love it. Question though, if you happen to know, will the ",{"type":21,"tag":83,"props":2089,"children":2091},{"className":2090},[],[2092],{"type":26,"value":2093},"DebugWriter",{"type":26,"value":2095}," basically get compiled away in release mode?",{"title":80,"searchDepth":142,"depth":142,"links":2097},[],"content:comments:linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers:151925.md","comments/linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers/151925.md","comments/linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers/151925",{"_path":2102,"_dir":2051,"_draft":6,"_partial":6,"_locale":7,"title":2103,"description":2104,"id":2105,"name":2106,"email":2107,"avatar":2108,"date":2109,"body":2110,"_type":2027,"_id":2130,"_source":2029,"_file":2131,"_stem":2132,"_extension":2032},"/comments/linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers/48578","48578","Another great article, specially the ActionTextriter tip.",48578,"Júlio Nobre","julio.nobre@gmail.com","https://www.gravatar.com/avatar/c47ef84ed70c3802af8f1f3866bd19bb?r=pg&d=retro","2012-09-12T04:40:37",{"type":18,"children":2111,"toc":2128},[2112,2116],{"type":21,"tag":22,"props":2113,"children":2114},{},[2115],{"type":26,"value":2104},{"type":21,"tag":22,"props":2117,"children":2118},{},[2119,2121,2126],{"type":26,"value":2120},"To improve it I would like to suggest you to prefix sample classes with ",{"type":21,"tag":87,"props":2122,"children":2123},{},[2124],{"type":26,"value":2125},"public",{"type":26,"value":2127}," clause - a minor catch to newbies ;-)",{"title":80,"searchDepth":142,"depth":142,"links":2129},[],"content:comments:linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers:48578.md","comments/linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers/48578.md","comments/linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers/48578",{"_path":2134,"_dir":2051,"_draft":6,"_partial":6,"_locale":7,"title":2135,"description":2136,"id":2137,"name":2138,"email":2139,"avatar":2140,"date":2141,"body":2142,"_type":2027,"_id":2155,"_source":2029,"_file":2156,"_stem":2157,"_extension":2032},"/comments/linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers/46400","46400","Yes, great article. I had spent most of yesterday playing around with SQL Profiler just to end up with the same result as this solution only less conveniently.",46400,"Karl","karlnunweiler@gmail.com","https://www.gravatar.com/avatar/8dde5ed48260dc9ea5d1179c802bb72e?r=pg&d=retro","2011-09-09T03:46:18",{"type":18,"children":2143,"toc":2153},[2144,2148],{"type":21,"tag":22,"props":2145,"children":2146},{},[2147],{"type":26,"value":2136},{"type":21,"tag":22,"props":2149,"children":2150},{},[2151],{"type":26,"value":2152},"Thanks very much.",{"title":80,"searchDepth":142,"depth":142,"links":2154},[],"content:comments:linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers:46400.md","comments/linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers/46400.md","comments/linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers/46400",{"_path":2159,"_dir":2051,"_draft":6,"_partial":6,"_locale":7,"title":2160,"description":2161,"id":2162,"name":2163,"email":2164,"avatar":2165,"url":2166,"date":2167,"body":2168,"_type":2027,"_id":2185,"_source":2029,"_file":2186,"_stem":2187,"_extension":2032},"/comments/linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers/43911","43911","Hi,\nThis is excellent article.\nI used your class ActionTextWritter to track progress of the ctx.SubmitChanges()",43911,"Emir","epandzo@gmail.com","https://www.gravatar.com/avatar/f7841075b8f87b26f91e49f7c0b030ad?r=pg&d=retro","https://epandzo.wordpress.com","2011-01-02T07:01:00",{"type":18,"children":2169,"toc":2183},[2170,2174],{"type":21,"tag":22,"props":2171,"children":2172},{},[2173],{"type":26,"value":2161},{"type":21,"tag":22,"props":2175,"children":2176},{},[2177],{"type":21,"tag":52,"props":2178,"children":2181},{"href":2179,"rel":2180},"http://epandzo.wordpress.com/2011/01/02/linq-to-sql-ctx-submitchanges-progress/",[56],[2182],{"type":26,"value":2179},{"title":80,"searchDepth":142,"depth":142,"links":2184},[],"content:comments:linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers:43911.md","comments/linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers/43911.md","comments/linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers/43911",{"_path":2189,"_dir":2051,"_draft":6,"_partial":6,"_locale":7,"title":2190,"description":2191,"id":2192,"name":2193,"email":2194,"avatar":2195,"date":2196,"body":2197,"_type":2027,"_id":2205,"_source":2029,"_file":2206,"_stem":2207,"_extension":2032},"/comments/linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers/32309","32309","These are very cool and useful. Thanks for sharing.",32309,"Thiago leite","brasilokau@hotmail.com","https://www.gravatar.com/avatar/16fc7674b04993f85de7895edd7c6645?r=pg&d=retro","2009-12-11T08:59:25",{"type":18,"children":2198,"toc":2203},[2199],{"type":21,"tag":22,"props":2200,"children":2201},{},[2202],{"type":26,"value":2191},{"title":80,"searchDepth":142,"depth":142,"links":2204},[],"content:comments:linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers:32309.md","comments/linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers/32309.md","comments/linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers/32309",{"_path":2209,"_dir":2051,"_draft":6,"_partial":6,"_locale":7,"title":2210,"description":2211,"id":2212,"name":2213,"email":2214,"avatar":2215,"date":2216,"body":2217,"_type":2027,"_id":2225,"_source":2029,"_file":2226,"_stem":2227,"_extension":2032},"/comments/linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers/10118","10118","How do I also log the parameter values?",10118,"Smit","smit@dealersource.net","https://www.gravatar.com/avatar/455b0ffe1803d92348ee2c27e8d246aa?r=pg&d=retro","2008-11-05T12:25:40",{"type":18,"children":2218,"toc":2223},[2219],{"type":21,"tag":22,"props":2220,"children":2221},{},[2222],{"type":26,"value":2211},{"title":80,"searchDepth":142,"depth":142,"links":2224},[],"content:comments:linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers:10118.md","comments/linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers/10118.md","comments/linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers/10118",1779264586751]