How can I show only queries made by EF in SQL Profiler?
As you can see on the screenshot the query highlighted in red is the one which I was created with the help of the EF. All the others are generated from somewhere else and I would like to hide them.
Is it possible?
UPDATE
When I try to specify the applicationName
in the connection string I get an error.
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) {
if (!optionsBuilder.IsConfigured) {
optionsBuilder.UseSqlServer("Server=.\\;Database=AdventureWorksLT2012;Trusted_Connection=True;applicationName=FOO_NAME");
}
}
Unhandled exception. System.ArgumentException: Keyword not supported: 'applicationname'. at Microsoft.Data.Common.DbConnectionOptions.ParseInternal(Dictionary
2 parsetable, String connectionString, Boolean buildChain, Dictionary
2 synonyms, Boolean firstKey) at Microsoft.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms)
What am I missing here?
When your EF DbContext has it's own connection string, you can set ';Application Name=EF' in your connection string and filter in profiler for this application name.
You do it either on the Trace Properties dialog on connecting
When you are already connected to the server you press the Properties icon in the toolbar and do the same.