2012-02-13 5 views
6

Sto provando a scrivere un modulo per aggiungere un commento contenente informazioni utili a ogni query Linq2Entities SQL emessa da un framework di entità DbContext (le informazioni verranno utilizzate nel debug).Come posso aggiungere informazioni a ogni SqlCommand emesso da un DbContext?

Utilizzo di Linq2Sql, in precedenza l'avevo già eseguito estendendo la classe di comando MvcMiniProfiler ProfiledDbCommand. Tuttavia, non riesco a ottenere lo stesso approccio per lavorare con EF/DbContext. Ho prorogato EFProfiledDbCommand, ma non funziona. In effetti, anche un uso rettilineo di EFProfiledDbCommand non funziona: ho l'errore

Impossibile determinare il nome del provider per la connessione di tipo 'MvcMiniProfiler.Data.EFProfiledDbConnection'.

Qualcuno può fornire sia soluzione per la mia soluzione corrente o un approccio alternativo a questo problema?

+1

Ciao, dai un'occhiata qui: http://stackoverflow.com/questions/6295802/how-do-you-use-the-mvc-mini-profiler-with-entity-framework-4-1 –

+2

Potresti trovare il [Entity Framework Tracing Provider] (http://nuget.org/packages/CommunityEFProviderWrappers.EFTracingProvider) di interesse. – AakashM

+0

Anche EFHooks viene in mente: http://www.mcdev.za.net/efhooks-project/ – jessehouwing

risposta

Problemi correlati