How to configure mvc-mini-profiler using EF 4.2 Code first

EF 4.1 Version 1 had a profiling error that was fixed, and I'm trying to get profiling using MySql with EF 4.2 Code First.

I tried to put

MiniProfilerEF.Initialize ();

at the beginning of my application but got an error

Could not find the requested .Net Framework data provider. It cannot be installed.

+6
source share
1 answer

http://code.google.com/p/mvc-mini-profiler/

EF 4.1 Update 1

Please note that EF 4.1 Update 1 (version currently on NuGet) has a gap change that throws the following error when specifying a connection string:

The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)

MiniProfiler tries to solve this problem by discovering the version from EntityFramework that it works with. If this does not work (due to security exceptions), force a hack by replacing the Initialize () call as follows:

MiniProfilerEF.Initialize_EF42(); // in Application_Start

However, it is currently not possible to profile SqlCE or Oracle databases.

To get around this, the additional parameter Initialize Call is added:

If you specify connection strings explicitly in your web.config, use MiniProfilerEF.Initialize(); . This will not profile SqlCE or Oracle databases. If you do not specify connection strings (automatically displayed) and want SqlCE support, use MiniProfilerEF.Initialize(false); . Please note that this should be temporary until EF 4.2 is widely available.

+1
source

Source: https://habr.com/ru/post/900740/


All Articles