mishrsud / mvc-mini-profiler

Automatically exported from code.google.com/p/mvc-mini-profiler
0 stars 0 forks source link

ProfiledDbConnection missing Get #109

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Added latest reference from NuGet manager
2  Get compile error saying ProfiledDbConnection is missing Get
3. Can't build

What is the expected output? What do you see instead?
Should have a Get for passing in EF connection.

What version of the product are you using? On what operating system?
1.9.0

Please provide any additional information below.

 var conn = MvcMiniProfiler.Data.ProfiledDbConnection.Get(GetConnection());
            _dbContext = ObjectContextUtils.CreateObjectContext<eKMEntities>(conn);

Original issue reported on code.google.com by Eric.R.H...@gmail.com on 14 Sep 2011 at 4:51

GoogleCodeExporter commented 8 years ago
This is by-design, I removed Get ... instead use the constructor 

Having it in a static meant you could not properly inherit off profiled 
connection which in turn meant we could not pull out the EF code to its own 
assembly 

Original comment by sam.saff...@gmail.com on 15 Sep 2011 at 1:38

GoogleCodeExporter commented 8 years ago
Can you give us the code for using it by constructor?  The documentation hasn't 
been updated on this project

Original comment by notda...@gmail.com on 22 Sep 2011 at 5:09

GoogleCodeExporter commented 8 years ago
this is what I used 

    private MyEntities CreateDBContext()
        {
            var dbConnection = GetConnection();
            if (_enableProfiling)
            {
                dbConnection = new EFProfiledDbConnection(dbConnection, MiniProfiler.Current);
            }
            return dbConnection.CreateObjectContext<MyEntities>();
        }

        private DbConnection GetConnection()
        {
            var connectionString = new EntityConnectionStringBuilder(ConfigurationManager.ConnectionStrings["MyEntities"].ConnectionString);
            DbConnection dbConnection = new SqlConnection(connectionString.ProviderConnectionString);
            return dbConnection;
        }

Original comment by Eric.R.H...@gmail.com on 22 Sep 2011 at 5:12

GoogleCodeExporter commented 8 years ago
Where do you define EFProfiledDbConnection?

Original comment by notda...@gmail.com on 22 Sep 2011 at 5:19

GoogleCodeExporter commented 8 years ago
Should be part of the MvcMiniProfiler.Data namespace.  Make sure you are 
running the latest dll since there was a major update and they didn't update 
the documentation.  

Original comment by Eric.R.H...@gmail.com on 22 Sep 2011 at 5:25

GoogleCodeExporter commented 8 years ago
EFProfiledDbConnection is in MiniProfiler.EF 

Original comment by sam.saff...@gmail.com on 23 Sep 2011 at 10:55