view sql that linq-to-sql produces

前端 未结 3 1282
無奈伤痛
無奈伤痛 2021-01-24 06:38

Other than using profiler, is there a way to view the sql that linq-to-sql produces?

3条回答
  •  独厮守ぢ
    2021-01-24 07:15

    You can use the Log property on the DataContext to write out what the SQL is. This takes a TextWriter and is pretty easy to use. If you need an example I can provide you one.

    DataContext Log

提交回复
热议问题