Log in


   Active Threads  

You are here: Home > LLBLGen Pro > Bugs & Issues> None of the factories in the list of 'Devart.Data.MySql' were found.

Pages: 1
Bugs & Issues
None of the factories in the list of 'Devart.Data.MySql' were found.

  Print all messages in this thread  
Poster Message


Joined on:
02-Jan-2019 16:48:19
13 posts
# Posted on: 27-Dec-2019 12:37:10.  

So, I have a web application using an old Telerik ORM setup and a MySQL database, and I want to replace it with LLBLGen. I've never really used LLBLGen before, so "virgin territory" here...

I have done a Database first model and created source code (adapter templates) and when I try to do a very simple query;

            System.Diagnostics.Trace.TraceInformation("messaage here");
            var products = new EntityCollection<ProductEntity>();

            using (var adapter = new DataAccessAdapter(connectionString))
                var qf = new QueryFactory();
                var q = qf.Product.Where(ProductFields.Productid > -1);
                adapter.FetchQuery(q, products);

            foreach (var productEntity in products)
                uiTest.Text += $@"{productEntity.Description}<br/>";

I get this error:

Message=The type initializer for 'SD.LLBLGen.Pro.DQE.MySql.DynamicQueryEngine' threw an exception.
at SD.LLBLGen.Pro.DQE.MySql.DynamicQueryEngine..ctor()
at NHL.Admin.DataModel.DatabaseSpecific.DataAccessAdapter.CreateDynamicQueryEngine() in D:\projects\NHL\nhladmin\NHL.Admin.DataModel\DatabaseSpecific\DataAccessAdapter.cs:line 85
at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.get_FunctionMappings()
at SD.LLBLGen.Pro.QuerySpec.Adapter.AdapterExtensionMethods.FetchQuery[TCollection](IDataAccessAdapter adapter, IEntityQueryInternal query, TCollection collectionToFill)
at SD.LLBLGen.Pro.QuerySpec.Adapter.AdapterExtensionMethods.FetchQuery[TEntity,TCollection](IDataAccessAdapter adapter, EntityQuery`1 query, TCollection collectionToFill)
at NHL.Administration.AdminWebsite.ProductsOverview.Page_Load(Object sender, EventArgs e) in D:\projects\NHL\nhladmin\NHL.Administration.AdminWebsite\ProductsOverview.aspx.cs:line 27

Inner Exception 1:
ORMGeneralOperationException: None of the factories in the list of 'Devart.Data.MySql' were found. Please check machine.config and the .NET version your application is running on.

I have added trace configuration in web.config:
     <add name="MySqlDQE" value="4" />
     <add name="ORMGeneral" value="4" />
     <add name="ORMQueryExecution" value="4" />
     <add name="ORMStateManagement" value="4" />
     <add name="ORMPersistenceExecution" value="4" />
     <add name="ORMPlainSQLQueryExecution" value="4" />
     <add name="LinqExpressionHandler" value="4" />

    <trace autoflush="false" indentsize="4">
        <add name="myListener" type="System.Diagnostics.TextWriterTraceListener, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" initializeData="TextWriterOutput.log" />
        <!--<remove name="Default" />-->

But I only get the "message here" test trace message in the file - so I don't think that LLBLGen emits anything further, when this exception occurs.

So the question is - why does this happen?

A partial solution:

I have discovered that we have previously entered this in web.config

     <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data" />

According to commit messages (2 years ago), this was needed to get our build server to build the project. I don't know why Regular Smiley

If I remove the DbProviderFactories section from web.config, the code runs fine (and emits a ton of tracemessages btw, so that part is configured correctly)

In machine.config I have this:

     <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient"
        description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
     <add name="dotConnect for MySQL" invariant="Devart.Data.MySql"
        description="Devart dotConnect for MySQL" type="Devart.Data.MySql.MySqlProviderFactory, Devart.Data.MySql, Version=8.16.1541.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />

The problem is that we apparently need that part of web.config for builds to run - so I'm not sure if I can safely delete it.

I have tried to add the second one (<add name="dotConnect for MySQL" invariant="Devart.Data.MySql"...>) from machine.config to web.config, but that doesn't change anything.

I'm kind of lost here - probably because I don't fully understand the purpose of the DbProviderFactories section of machine.config / web.config. I thought web.config would overwrite the specifics from machine.config, but in that case it shouldn't matter if I repeat machine.config values in web.config.

Any ideas/insights as to what is actually going on?

Thanks in advance!

MySQL version 5.6.43
LLBLGen version 5.6 (5.6.1) RTM
DevArt version (latest express from their website - 8.16 apparently)
Asp.net web project targets .net version 4.6
Nuget packages:
SD.LLBLGen.Pro.DQE.MySql - 5.6.1
SD.LLBLGen.Pro.ORMSupportClasses - 5.6.1
SD.LLBLGen.Pro.ORMSupportClasses.Web - 5.6.1

Support Team


Joined on:
21-Aug-2005 16:03:48
14618 posts
# Posted on: 27-Dec-2019 14:31:14.  
Try removing the DbProviderFactories in the web.config.
And make sure the one in the machine.config, is in the machine.config that your application is targeting (32bit vs 64bit).



Joined on:
02-Jan-2019 16:48:19
13 posts
# Posted on: 27-Dec-2019 14:36:36.  

Thanks for your answer Regular Smiley

Yeah... as I wrote: If I remove the DbProviderFactories section from web.config, the code runs fine. So I already know that.

However, I'm not sure I can do that due to our build server setup.

Could you elaborate on the "And make sure the one in the machine.config, is in the machine.config that your application is targeting (32bit vs 64bit)." part?

Where do I look? Would it be redundant to have the same configuration in both machine.config and web.config?
What is it there for?
What does the error message from llblgen mean?

Best regards
LLBLGen Pro Team

The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
38021 posts
# Posted on: 28-Dec-2019 09:12:25.  
A factory can be defined in either the machine.config file or the app/web.config file of the application. If it's defined in the machine.config file, you first have to 'undefine' it in the app/web.config file (using the <remove invariantname=""> element, see '<DbProviderFactories>' documentation in Microsoft Docs). There are 2 machine.config files: one for 32bit .NET and one for 64bit .NET:
c:\windows\Microsoft.NET\Framework\v4.0....\Config << 32bit
c:\windows\Microsoft.NET\Framework64\v4.0....\Config << 64bit

So if you have an entry in the 64bit machine.config file, and your website runs as a 32bit application inside IIS, then the 32bit machine.config file will be read at runtime by DbProviderFactories (a .NET class) and not the 64bit one Regular Smiley

I think that's why you need the part in your web.config file, your webapp likely runs as 32bit (I think that's the default under some IIS versions, but not sure) and therefore a machine.config file without the right factory is used.

Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
Pages: 1  

Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.