Issue with running stored procedures through LLBL while having the Profiler on

46 views
Skip to first unread message

Teme

unread,
Jan 22, 2011, 12:58:04 PM1/22/11
to LLBLGenProf
Unable to cast object of type
'HibernatingRhinos.Profiler.Appender.ProfiledDataAccess.ProfiledConnection'
to type 'System.Data.SqlClient.SqlConnection'.

Here is the full 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.System.Data.IDbCommand.set_Connection(IDbConnection
value) +48
SD.LLBLGen.Pro.ORMSupportClasses.Query.set_Connection(IDbConnection
value) in C:\Myprojects\VS.NET Projects\LLBLGen Pro
v2.0\RuntimeLibraries 2.6 .NET 2.x\ORMSupportClasses\Query\Query.cs:
343

SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.CreateActiveConnectionInQueryIfRequired(IQuery
queryToExecute, Boolean forceConnectionSet) in C:\Myprojects\VS.NET
Projects\LLBLGen Pro v2.0\RuntimeLibraries 2.6 .NET 2.x
\ORMSupportClasses\AdapterSpecific\DataAccessAdapterBase.cs:5261

SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.PrepareQueryExecution(IQuery
queryToExecute, Boolean forceConnectionSet) in C:\Myprojects\VS.NET
Projects\LLBLGen Pro v2.0\RuntimeLibraries 2.6 .NET 2.x
\ORMSupportClasses\AdapterSpecific\DataAccessAdapterBase.cs:5285

SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchDataReader(IRetrievalQuery
queryToExecute, CommandBehavior readerBehavior) in C:\Myprojects
\VS.NET Projects\LLBLGen Pro v2.0\RuntimeLibraries 2.6 .NET 2.x
\ORMSupportClasses\AdapterSpecific\DataAccessAdapterBase.cs:1523

DefaultResource.DAL.DatabaseSpecific.DataAccessAdapter.FetchDataReader(IRetrievalQuery
queryToExecute, CommandBehavior readerBehavior) in C:\Default Resource
- Active Development\DefaultResource.DAL\DatabaseSpecific
\DataAccessAdapter.cs:292

DefaultResource.BLL.Common.CommonLogic.GetSecuredResource(IPredicate
predicate) in C:\Default Resource - Active Development
\DefaultResource.BLL.Common\SecurityLogic.cs:86
DefaultResource.BLL.Common.CommonLogic.GetSecuredResource(String
name) in C:\Default Resource - Active Development
\DefaultResource.BLL.Common\SecurityLogic.cs:107

DefaultResource.Web.ApplicationServices.Stubs.MenuService.GetMenuItems()
in C:\Default Resource - Active Development
\DefaultResource.Web.ApplicationServices\Stubs\MenuService.cs:15
DefaultResource.Web.Helpers.MenuBuilder.GetMenuItems() in C:
\Default Resource - Active Development\DefaultResource.Web\Helpers
\MenuBuilder.cs:28
ASP.views_shared_site_master.__Render__control1(HtmlTextWriter __w,
Control parameterContainer) in c:\Default Resource - Active Development
\DefaultResource.Web\Views\Shared\Site.Master:99
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer,
ICollection children) +256
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
System.Web.UI.Control.Render(HtmlTextWriter writer) +10
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer,
ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer,
ControlAdapter adapter) +99
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer,
ICollection children) +134
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
System.Web.UI.Page.Render(HtmlTextWriter writer) +29
System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer) +59
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer,
ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer,
ControlAdapter adapter) +99
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+1266

Any ideas?

Frans Bouma

unread,
Jan 22, 2011, 2:34:49 PM1/22/11
to llblg...@googlegroups.com
The profiler works with v3, not v2.6

FB

TEMESGEN MEHERET

unread,
Jan 22, 2011, 2:39:00 PM1/22/11
to llblg...@googlegroups.com
Thanks for the quick reply. I will just use the old system diagnostic switches for now.

TEMESGEN MEHERET

unread,
Jan 22, 2011, 5:54:54 PM1/22/11
to llblg...@googlegroups.com
Thanks for the quick reply. I will just use the old system diagnostic switches for now.

On Sat, Jan 22, 2011 at 2:34 PM, Frans Bouma <fr...@sd.nl> wrote:

Frans Bouma

unread,
Jan 23, 2011, 5:08:08 AM1/23/11
to llblg...@googlegroups.com
> Thanks for the quick reply. I will just use the old system diagnostic
> switches for now.

You can hack it into the code though. You have to alter the
daaAdapter.template for that (so it generates a different DataAccessAdapter
class). It comes down to: instead of using hardcoded SqlConnection,
SqlCommand and SqlParameter, you can use the DbProviderFactory and create
parameter, connection and command with that factory for the stored procedure
call code. In v2.6 this code is in the generated DataAccessAdapter class. In
v3 this has been refactored into its own class using the factory logic of
the DynamicQuery engine for the database the adapter is used with.

FB

TEMESGEN MEHERET

unread,
Jan 23, 2011, 6:44:50 PM1/23/11
to llblg...@googlegroups.com
Ah perfect that works.

Thanks.
Reply all
Reply to author
Forward
0 new messages