DynamicQueryEngine exception from RetrievalProcedures

Posts   
 
    
kooshka
User
Posts: 39
Joined: 14-Mar-2013
# Posted on: 04-Apr-2013 12:56:42   

I have this call to a Stored Procedure


toReturn = IsUserInRole(username, "Sys Admin") 

and this is that function


public override bool IsUserInRole(string username, string roleName)
{
    DataTable toReturn;
    using (new DataAccessAdapter())
    {
        toReturn = RetrievalProcedures.IsUserInRole(username, roleName);
     }

     return toReturn.Rows.Count > 0;
}

But an exception is thrown at


protected override DynamicQueryEngineBase CreateDynamicQueryEngine()
{
    return this.PostProcessNewDynamicQueryEngine(new DynamicQueryEngine());
}

The exception is


The type initializer for 'SD.LLBLGen.Pro.DQE.SqlServer.DynamicQueryEngine' threw an exception.

and the innerException


Failed to find or load the registered .Net Framework Data Provider.

This is the StackTrace


at SD.LLBLGen.Pro.DQE.SqlServer.DynamicQueryEngine..ctor()
   at DatabaseSpecific.DataAccessAdapter.CreateDynamicQueryEngine() in C:\Users\w059\Documents\LLBLGen Pro Projects\DatabaseSpecific\DataAccessAdapter.cs:line 117
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.GetDbSpecificCreatorInstance() in c:\Myprojects\VS.NET Projects\LLBLGen Pro v3.5\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAccessAdapterBase.cs:line 3606
   at SD.LLBLGen.Pro.ORMSupportClasses.StoredProcedureCall..ctor(IDataAccessCore dataAccessProvider, String storedProcedureName, String mappedCallName) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v3.5\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\Persistence\StoredProcedureCall.cs:line 73
   at DatabaseSpecific.RetrievalProcedures.CreateIsUserInRoleCall(IDataAccessCore dataAccessProvider, String username, String roleName) in C:\Users\w059\Documents\LLBLGen Pro Projects\DatabaseSpecific\RetrievalProcedures.cs:line 192
   at DatabaseSpecific.RetrievalProcedures.IsUserInRole(String username, String roleName, IDataAccessCore dataAccessProvider) in C:\Users\w059\Documents\LLBLGen Pro Projects\DatabaseSpecific\RetrievalProcedures.cs:line 140
   at DatabaseSpecific.RetrievalProcedures.IsUserInRole(String username, String roleName) in C:\Users\w059\Documents\LLBLGen Pro Projects\DatabaseSpecific\RetrievalProcedures.cs:line 129
   at CloasMasterDataService.Security.RoleProvider.IsUserInRole(String username, String roleName) in C:\Users\w059\Documents\Visual Studio 2010\Projects\CloasMasterService\CloasMasterService\Security\RoleProvider.cs:line 21
   at CloasMasterDataService.DataService.IsUserInRole(String username, String roleName) in C:\Users\w059\Documents\Visual Studio 2010\Projects\CloasMasterService\CloasMasterService\DataService.svc.cs:line 52
   at CloasMasterDataService.DataService.GetAllowedTablesByUser(String username) in C:\Users\w059\Documents\Visual Studio 2010\Projects\CloasMasterService\CloasMasterService\DataService.svc.cs:line 41
   at SyncInvokeGetAllowedTablesByUser(Object , Object[] , Object[] )
   at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)

Can you guide me to what is wrong? Thanks

P.S. This is happening with v3.5 and it was working fine with v2.6

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 04-Apr-2013 20:25:19   

I think you might have a corrupted machine.config And you might need to repair/reinstall the .NET Framework.

Please check this post: http://www.vbforums.com/showthread.php?586621-RESOLVED-Failed-to-find-or-load-the-registered-.NET-Framework-Data-Provider

kooshka
User
Posts: 39
Joined: 14-Mar-2013
# Posted on: 05-Apr-2013 11:20:30   

Hi Walaa,

not sure that's the problem. If I go back and use v2.6 it works fine again.

I have both v2.6 and v3.5 installed on my machine, would there be any issue because of that? I'm running on a 64bit win7 machine.

I had a look and this are my machine.config DbProviderFactories sections:

v2.0.50727


<DbProviderFactories>
            <add name="Odbc Data Provider" invariant="System.Data.Odbc" description=".Net Framework Data Provider for Odbc" type="System.Data.Odbc.OdbcFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
            <add name="OleDb Data Provider" invariant="System.Data.OleDb" description=".Net Framework Data Provider for OleDb" type="System.Data.OleDb.OleDbFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
            <add name="OracleClient Data Provider" invariant="System.Data.OracleClient" description=".Net Framework Data Provider for Oracle" type="System.Data.OracleClient.OracleClientFactory, System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
            <add name="SqlClient Data Provider" invariant="System.Data.SqlClient" description=".Net Framework Data Provider for SqlServer" type="System.Data.SqlClient.SqlClientFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
            <add name="Microsoft SQL Server Compact Data Provider" invariant="System.Data.SqlServerCe.3.5" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=3.5.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
        </DbProviderFactories>

v4.0.30319


<DbProviderFactories>
            <add name="Microsoft SQL Server Compact Data Provider" invariant="System.Data.SqlServerCe.3.5" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=3.5.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
            <add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
        </DbProviderFactories>

Does this look correct to you?

kooshka
User
Posts: 39
Joined: 14-Mar-2013
# Posted on: 05-Apr-2013 12:34:27   

Does this help?

I can't find the "c:\Myprojects\VS.NET Projects\..." anywhere, where is it coming from?


at SD.LLBLGen.Pro.DQE.SqlServer.DynamicQueryEngine..ctor()\r\n   
at DatabaseSpecific.DataAccessAdapter.CreateDynamicQueryEngine() in C:\\Users\\w059\\Documents\\Visual Studio 2010\\Projects\\CloasMasterServices35\\Repositories\\DatabaseSpecific\\DataAccessAdapter.cs:line 117\r\n   
at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.get_FunctionMappings() in c:\\Myprojects\\VS.NET Projects\\LLBLGen Pro v3.5\\Frameworks\\LLBLGen Pro\\RuntimeLibraries\\ORMSupportClasses\\AdapterSpecific\\DataAccessAdapterBase.cs:line 6113"


FunctionMappings = '((SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase)(dataAccessProvider)).FunctionMappings' threw an exception of type 'System.TypeInitializationException'

While using v2.6


FunctionMappings = {SD.LLBLGen.Pro.ORMSupportClasses.FunctionMappingStore}

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 05-Apr-2013 15:39:54   

Installing different version of LLBLGen Pro side by side has no issues. Did you check the machine.config files inside Framework folder or Frameork64 ?

kooshka
User
Posts: 39
Joined: 14-Mar-2013
# Posted on: 05-Apr-2013 15:47:46   

Both, the settings are the same.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 06-Apr-2013 08:05:28   

Did you tried the solution in the link posted by Walaa (unistall/reinstall .net framework)?

David Elizondo | LLBLGen Support Team
kooshka
User
Posts: 39
Joined: 14-Mar-2013
# Posted on: 08-Apr-2013 09:40:00   

Hi daelmo,

I didn't re-install the .net framework, it's not the first thing you would want to do. I have however deployed my app to our dev staging server and it seems to work fine, which leads me to believe that the problem really is with my machine.

I'll do as Walaa suggested.

Thank you guys.