EF6.x Correlating Poor Performing SQL to Application Code

romiller.com

When using an O/RM, poor performing SQL statements are often not discovered until you (or your DBA) find that a particular query is slowing down your database server. At this point, it becomes hard to identify which piece of application code is causing that SQL to be executed.

An interceptor to log slow/failed SQL

In EF6.0.0 we introduced interceptors, which allow you to get into the pipeline just before, and just after, a query/command is sent to the database.

Here is an interceptor that detects queries/commands that either failed, or exceeded a chosen threshold for execution time. In addition to the query being executed, it logs the call stack. This allows us to identify which piece of our application code initiated the database operation.

This example writes to a log file, but you can log the information to wherever needed.

Registering the interceptor

The easiest way to get our…

View original post 133 more words

How do I get Java plugin working on Google Chrome? Re-Enabling Silverlight, Java and Facebook video!

Today me and probably the 3 billions of people trying using java applet on chrome has found that after the java upgrade, chrome was unable to run java applet anymore, this not because of java, but because of google that decided to drop/stop the support for NPAPI, that is a cross-platform architecture standard used by many browser to enable plugins/applet such as Silverlight, Java and Facebook Video. You can find more directly from java website “How do I use Java with the Google Chrome browser?” But there’s also a good news, you can re-enable it, by doing these steps:

  1. In your URL bar, enter:
    chrome://flags/#enable-npapi
  2. Click the enable link for the Enable NPAPI configuration option.
  3. Click the relaunch button that now appears at the bottom of the configuration page.

…and here we go!! God bless the configurations!

!!IMPORTANT UPDATES!!

This configuration is temporary and will work just until Chrome version 45 that will be released later in 2015. After the release of Chrome version 45, you’ll need to use an alternate web browser to load content that requires a NPAPI plugin.

How to open and close Flyouts in Universal apps using MVVM

Around and About .NET World

Some times ago we talked about how to open attached Flyouts and close them using custom behaviors and MVVM. This was necessary because the Flyout control doesn’t expose properties to control its visibility, so we need to use its ShowAt and Hide methods explicitly.

While this approach works correctly, we can obtain the same result in a more elegant way with two simple Attached Properties. The following is a generic version of the implementation shown in the article Using Windows 8.1 Flyout with MVVM and works with every control, not only buttons (remember, in fact, that we can attach a Flyout on any FrameworkElement).

Let’s start creating a FlyoutHelper class:

This code adds an IsOpen Attached Property to flyout objects. When it changes (lines 22-39), we check whether we want to open or close the Flyout: in the first case, we call the ShowAt method (lines 32), that actually…

View original post 234 more words

[MVP Summit 2014] Roslyn Hackathon, Analyzers!!

dotnet_logo

Today with my Italian friends (Raffaele Rialdi aka Raf, Marco Minerva and Renato Marzaro), we’re working on Roslyn, the new open source C# compiler by Microsoft community, in detail today we’re working on creating new analyzers, that helps developer with live feedback while developing, like validating a regular expression, before going live and see the exception at runtime, an analyzer can provide such a feedback while writing code / at compile-time.

Marco Minerva and me, we’re working on a regular expression analyzer, to help find if the literal regex written in code is valid, before run the application, will be just a prototype, and if it will works 🙂 will be push it on github (check our repo, starting from next week).

Stay tuned!! 🙂

PASS SQL Saturday Parma Agenda now available!

Alessandro Alpi's Blog

PASS SQL Saturday Parma agenda is now available!

This is the timetable:
From        To
————————–
10:00       11:00
11:15       12:15
12:30       13:30
13:30       14:30
14:30       15:30
15:45       16:45
16:45       17:00
17:00       18:00
————————–
 
We will have three tracks:
  • BI, for Business Intelligence, BigData, xVelocity, etc.
  • DEV, for developers 
  • OPS, for operations and administration
Checkout the agenda here and organize your Saturday with the schedule builder!
 
Stay Tuned! 🙂
 
 
 
 

View original post

Create C# enum template with SSMS Boost

Alessandro Alpi's Blog

I’ve spoken about SSMS Boost in this post and now I’m going to apply one of its feature in order to improve the productivity of my team. Speaking about the database side, a table that contains static data can be used as a foreign key referenced table. In my experience those kind of tables are often mapped to enums in our application layer. Creating that enum can be a tedious operation and sometimes it can be very uncomfortable. With SSMS Boost we can enhance our development experience.

View original post 787 more words