Our Sites
Categories
- Business (35)
- DelphiFeeds.com (87)
- General (43)
- Gurock Software (104)
- Programming (43)
- SmartInspect (123)
- Software Quality (6)
- TestRail (21)
- Virtualization (8)
- Websites (26)
Archives
User Pages Cloud
delphi unicode asp.net monitoring debug java debugging log4j logging trace delphi tracing asp.net exceptions errors debug .net debugging log4net log4n .net monitoring debug java debugging vb.net logging trace java tracing java exceptions errors delphi monitoring delphi debugging trace .net tracing delphi exceptions errors nlog asp.net logging tracing eurekalog




LINQ Logging with SmartInspect 3.0
LINQ and LINQ to SQL, Microsoft’s data querying language and ORM for .NET and SQL Server, allows developers to easily query databases without writing data access code or SQL statements. Although Microsoft built a great abstraction for working with data and made it a lot easier to build queries, it’s often still useful to take a look at the underlying SQL queries that LINQ generates.
We added a feature to SmartInspect’s .NET library that allows you to use LINQ’s logging capabilities with SmartInspect. By using this feature, you are able to live monitor the generated SQL queries directly in the Console or save the queries to log files for later analysis.
private IList<Order> GetOrdersByYear(int year) { // Enable SmartInspect logging SiAuto.Si.Enabled = true; using (var db = new NorthwindDataContext()) { // Attach SmartInspect logging db.Log = new SmartInspectLinqToSqlAdapter(); var query = from o in db.Orders where o.OrderDate >= new DateTime(year, 1, 1) o.OrderDate <= new DateTime(year, 12, 31) select o; // Execute the query return query.ToList(); } }When the LINQ SQL statements are viewed in the SmartInspect Console, you can easily inspect them with the built-in SQL / source viewer:
The SmartInspectLinqToSqlAdapter class is one of several adapters to make it easier to use SmartInspect with other platform and third-party logging classes. Next in our series on SmartInspect 3.0 come the new features in the SmarInspect Console.