Dear Sirs,
the CloneDBCommand throws an Exception if one uses EF together with StackExchange MiniProfiler:
```
Any exception caught System.InvalidCastException: Das Objekt des Typs "StackExchange.Profiling.Data.ProfiledDbCommand" kann nicht in Typ "System.Data.SqlClient.SqlCommand" umgewandelt werden.
bei System.Data.Entity.SqlServer.SqlProviderServices.CloneDbCommand(DbCommand fromDbCommand)
bei System.Data.Entity.Core.Common.DbCommandDefinition.CreateCommand()
bei EFCache.CachingCommandDefinition.CreateCommand()
bei System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.PrepareEntityCommandBeforeExecution(EntityCommand entityCommand)
bei System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
bei System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues)
bei System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__6()
bei System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
bei System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__5()
bei System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
bei System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
bei System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0()
bei System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
bei System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
bei System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__0[TResult](IEnumerable`1 sequence)
bei System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable`1 query, Expression queryRoot)
bei System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute[TResult](Expression expression)
bei System.Data.Entity.Internal.Linq.DbQueryProvider.Execute[TResult](Expression expression)
bei System.Linq.Queryable.First[TSource](IQueryable`1 source)
```
There was no problem in EF 6.1.1.
With best regards
Rufus
Comments: Thank you!
the CloneDBCommand throws an Exception if one uses EF together with StackExchange MiniProfiler:
```
Any exception caught System.InvalidCastException: Das Objekt des Typs "StackExchange.Profiling.Data.ProfiledDbCommand" kann nicht in Typ "System.Data.SqlClient.SqlCommand" umgewandelt werden.
bei System.Data.Entity.SqlServer.SqlProviderServices.CloneDbCommand(DbCommand fromDbCommand)
bei System.Data.Entity.Core.Common.DbCommandDefinition.CreateCommand()
bei EFCache.CachingCommandDefinition.CreateCommand()
bei System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.PrepareEntityCommandBeforeExecution(EntityCommand entityCommand)
bei System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
bei System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues)
bei System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__6()
bei System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
bei System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__5()
bei System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
bei System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
bei System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0()
bei System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
bei System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
bei System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__0[TResult](IEnumerable`1 sequence)
bei System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable`1 query, Expression queryRoot)
bei System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute[TResult](Expression expression)
bei System.Data.Entity.Internal.Linq.DbQueryProvider.Execute[TResult](Expression expression)
bei System.Linq.Queryable.First[TSource](IQueryable`1 source)
```
There was no problem in EF 6.1.1.
With best regards
Rufus
Comments: Thank you!