mishrsud / mvc-mini-profiler

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

Possible MiniProfiler.EF problem #121

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Start new MVC3 project.

2. At Package Manager Console:
   a. update-package entityframework
   b. install-package miniprofiler.mvc3
   c. install-package miniprofiler.ef
   d. update-package

3. Update connection strings at web.config.
<connectionStrings>
    <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true;" providerName="System.Data.SqlClient" />
    <add name="ApplicationDataStore" connectionString="Server=.\SQLEXPRESS;Database=zz;Integrated Security=True;MultipleActiveResultSets=True;" providerName="System.Data.SqlClient" />
  </connectionStrings>

4. Insert this statement: "MvcMiniProfiler.MiniProfilerEF.Initialize();" at the 
beginning of Application_Start().

5. Add https://gist.github.com/7a67f97014b106e446c0 into the project.

6. At HomeController.Index() do:
string username = "fake!" + Guid.NewGuid().ToString();
Membership.CreateUser(username, username, "fake@me.com");
Membership.DeleteUser(username);
new MembershipProviderContext("ApplicationServices")
    .Accounts.Where(zz => zz.ApplicationId == THE_APPLICATION_ID)
    .ToList();

7. Run the application.

What is the expected output?
No exception is thrown.

What do you see instead?
System.InvalidOperationException was unhandled by user code
  Message=Unable to complete operation. The supplied SqlConnection does not specify an initial catalog.
  Source=System.Data.Entity
  StackTrace:
       at System.Data.SqlClient.SqlProviderServices.GetDatabaseName(SqlConnection sqlConnection)
       at System.Data.SqlClient.SqlProviderServices.DbDatabaseExists(DbConnection connection, Nullable`1 commandTimeout, StoreItemCollection storeItemCollection)
       at System.Data.Common.DbProviderServices.DatabaseExists(DbConnection connection, Nullable`1 commandTimeout, StoreItemCollection storeItemCollection)
       at MvcMiniProfiler.Data.ProfiledDbProviderServices.DbDatabaseExists(DbConnection connection, Nullable`1 commandTimeout, StoreItemCollection storeItemCollection) in C:\Users\sam\Desktop\mvc-mini-profiler\MvcMiniProfiler.EntityFramework\ProfiledDbProviderServices.cs:line 66
       at System.Data.Objects.ObjectContext.DatabaseExists()
       at System.Data.Entity.Internal.DatabaseOperations.Exists(ObjectContext objectContext)
  InnerException: 

What version of the product are you using? 
MiniProfiler.MVC3 1.9.1
MiniProfiler.EF 1.9.1
EntityFramework 4.2.0.0

On what operating system?
Windows 7 (6.1.7600)

Please provide any additional information below.
No exception is thrown if I comment out this statement 
"MvcMiniProfiler.MiniProfilerEF.Initialize();".

Original issue reported on code.google.com by dvs...@gmail.com on 18 Nov 2011 at 4:44