LLBL Gen 4.2 with MySql

Posts   
 
    
hplloyd
User
Posts: 191
Joined: 29-Oct-2004
# Posted on: 07-Apr-2017 03:53:34   

Hi,

I have been using version 4.1 for a while and think it is time to upgrade to 4.2

I have installed the LLBLGen designer and updated my DevArt MySql ADO.NET driver to version 8.8.862.0. The designer seems to be working for me now - It did not like that I had an older version of DevArt, but the update fixed that

I have loaded my llblgen projects into V4.2 and regenerated, then fixed up all the references libraries in my project to 4.2 so my solution now builds with no errors

When I run my application the first time it tries to contact the database it crashes with the following error

System.TypeInitializationException was unhandled by user code
  HResult=-2146233036
  Message=The type initializer for 'SD.LLBLGen.Pro.DQE.MySql.DynamicQueryEngine' threw an exception.
  Source=SD.LLBLGen.Pro.DQE.MySql
  TypeName=SD.LLBLGen.Pro.DQE.MySql.DynamicQueryEngine
  StackTrace:
       at SD.LLBLGen.Pro.DQE.MySql.DynamicQueryEngine..ctor()
       at Carefo.Engine.Control.DatabaseSpecific.DataAccessAdapter.CreateDynamicQueryEngine() in C:\Data\NET45\Carefo\Carefo.Engine.Control\DatabaseSpecific\DataAccessAdapter.cs:line 98
       at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.GetDbProviderFactoryInstance() in c:\Myprojects\VS.NET Projects\LLBLGen Pro v4.2\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAccessAdapterCore.cs:line 3375
       at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.CreateNewPhysicalConnection(String connectionString) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v4.2\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAccessAdapterCore.cs:line 3410
       at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.AssureConnectionIsPresent() in c:\Myprojects\VS.NET Projects\LLBLGen Pro v4.2\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAccessAdapterCore.cs:line 4995
       at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.OpenConnection() in c:\Myprojects\VS.NET Projects\LLBLGen Pro v4.2\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAccessAdapterCore.cs:line 888
       at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.StartTransaction(IsolationLevel isolationLevelToUse, String name) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v4.2\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAccessAdapterCore.cs:line 728
       at SD.LLBLGen.Pro.ORMSupportClasses.UnitOfWork2.CommitImpl(IDataAccessAdapter adapterToUse, Boolean autoCommit) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v4.2\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\UnitOfWork\UnitOfWork2.cs:line 728
  InnerException: 
       BareMessage=An error occurred creating the configuration section handler for system.data: Column 'InvariantName' is constrained to be unique.  Value 'Devart.Data.MySql' is already present.
       Filename=C:\Data\NET45\Carefo\Carefo.QueueProcessor.Console\bin\Debug\Carefo.QueueProcessor.Console.vshost.exe.Config
       HResult=-2146232062
       Line=80
       Message=An error occurred creating the configuration section handler for system.data: Column 'InvariantName' is constrained to be unique.  Value 'Devart.Data.MySql' is already present. (C:\Data\NET45\Carefo\Carefo.QueueProcessor.Console\bin\Debug\Carefo.QueueProcessor.Console.vshost.exe.Config line 80)
       Source=System.Configuration
       StackTrace:
            at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)
            at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
            at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
            at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
            at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
            at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
            at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
            at System.Configuration.ConfigurationManager.GetSection(String sectionName)
            at System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName)
            at System.Data.Common.DbProviderFactories.Initialize()
            at System.Data.Common.DbProviderFactories.GetProviderTable()
            at System.Data.Common.DbProviderFactories.GetFactoryClasses()
            at SD.LLBLGen.Pro.DQE.MySql.DynamicQueryEngine..cctor() in c:\Myprojects\VS.NET Projects\LLBLGen Pro v4.2\Frameworks\LLBLGen Pro\RuntimeLibraries\MySqlDQE\DynamicQueryEngine.cs:line 92
       InnerException: 
            HResult=-2146232022
            Message=Column 'InvariantName' is constrained to be unique.  Value 'Devart.Data.MySql' is already present.
            Source=System.Data
            StackTrace:
                 at System.Data.UniqueConstraint.CheckConstraint(DataRow row, DataRowAction action)
                 at System.Data.DataTable.RaiseRowChanging(DataRowChangeEventArgs args, DataRow eRow, DataRowAction eAction, Boolean fireEvent)
                 at System.Data.DataTable.SetNewRecordWorker(DataRow row, Int32 proposedRecord, DataRowAction action, Boolean isInMerge, Boolean suppressEnsurePropertyChanged, Int32 position, Boolean fireEvent, Exception& deferredException)
                 at System.Data.DataTable.InsertRow(DataRow row, Int64 proposedID, Int32 pos, Boolean fireEvent)
                 at System.Data.Common.DbProviderFactoriesConfigurationHandler.DbProviderDictionarySectionHandler.HandleAdd(XmlNode child, DataTable config)
                 at System.Data.Common.DbProviderFactoriesConfigurationHandler.DbProviderDictionarySectionHandler.CreateStatic(DataTable config, Object context, XmlNode section)
                 at System.Data.Common.DbProviderFactoriesConfigurationHandler.CreateStatic(Object parent, Object configContext, XmlNode section)
                 at System.Data.Common.DbProviderFactoriesConfigurationHandler.Create(Object parent, Object configContext, XmlNode section)
                 at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSectionImpl(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader)
                 at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSectionWithRestrictedPermissions(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader)
                 at System.Configuration.RuntimeConfigurationRecord.CreateSection(Boolean inputIsTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader)
                 at System.Configuration.BaseConfigurationRecord.CallCreateSection(Boolean inputIsTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader, String filename, Int32 line)
            InnerException: 

It looks it is complaining about this block I have amended in my app.config


 <system.data>
    <DbProviderFactories>
      <add name="dotConnect for MySQL" invariant="Devart.Data.MySql" description="Devart dotConnect for MySQL" type="Devart.Data.MySql.MySqlProviderFactory, Devart.Data.MySql, Version=8.8.862.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
    </DbProviderFactories>
  </system.data>

but this was there in v4.1 albeit I have changed the version number to 8.8.862.0

What am I doing wrong???

Many thanks in advance

hplloyd
User
Posts: 191
Joined: 29-Oct-2004
# Posted on: 07-Apr-2017 04:03:41   

Just noticed that if i remove the DbProviderFactories section from my App/Web config all works fine - I guess you made a change in 4.2 meaning this no longer required ?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 07-Apr-2017 08:58:42   

The driver installer already put that DProviderFactory in your machine.config, so it's not necessary to put it in your .config file.

David Elizondo | LLBLGen Support Team
hplloyd
User
Posts: 191
Joined: 29-Oct-2004
# Posted on: 08-Apr-2017 06:17:24   

Does that mean I still need it for when I publish my web app as I don't have the driver installed on the web servers? - So I assume I need to remove from machine.config?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 08-Apr-2017 08:58:41   

you need the ado.net provider to connect to the database, and the machine you want to run your application on has to have that ado.net provider installed.

Frans Bouma | Lead developer LLBLGen Pro