Ryan
unread,Dec 10, 2010, 6:57:51 AM12/10/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to nhprof
I'm trying to use Entity Framework Profiler for the first time and
I've ran into this problem straight away. Using .NET 4.0, referenced
the v4.0.dll and added the initialise to the application start. The
first EF call throws the above error.
The stack trace:
[InvalidCastException: Unable to cast object of type
'HibernatingRhinos.Profiler.Appender.ProfiledDataAccess.ProfiledConnection'
to type 'System.Data.SqlClient.SqlConnection'.]
System.Data.SqlClient.SqlCommand.set_DbConnection(DbConnection
value) +31
System.Data.Common.DbCommand.set_Connection(DbConnection value) +9
System.Data.Common.Utils.CommandHelper.SetStoreProviderCommandState(EntityCommand
entityCommand, EntityTransaction entityTransaction, DbCommand
storeProviderCommand) +60
System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand
entityCommand, CommandBehavior behavior) +109
System.Data.Objects.Internal.ObjectQueryExecutionPlan.Execute(ObjectContext
context, ObjectParameterCollection parameterValues) +736
System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1
forMergeOption) +149
System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
+44
System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source) +182
System.Data.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__1(IEnumerable`1
sequence) +41
System.Data.Objects.ELinq.ObjectQueryProvider.ExecuteSingle(IEnumerable`1
query, Expression queryRoot) +59
System.Data.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute(Expression
expression) +150
System.Linq.Queryable.FirstOrDefault(IQueryable`1 source) +265
isnapshot.Data.EF.Repository.UserRepository.FindByUsernamePasswordWithRoles(String
username, String password)
Not sure what is going on here.