Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6806735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:44:49+00:00 2026-05-26T19:44:49+00:00

I am playing with Castle activeRecord, and I have succesfully made an asp.net MVC

  • 0

I am playing with Castle activeRecord, and I have succesfully made an asp.net MVC app, that can generate the schema, do crud operations and query the mysql database. I have done this in MonoDevelop.

Werid thing is, if I use almost the exact same code in a commandline project, it doesn’t work, throwing the following exception:

Could not create the driver from NHibernate.Driver.MySqlDataDriver

The exception is thrown at the pc.Create(); in the code below. Even though I tell it to generate the schema, this never actually happens, but it does happen in the web app.

Some googling of this message indicates that this happens when the mysql.data.dll file isn’t in the path or referenced etc. It is referenced, and “local Copy” is enabled so it gets copied into the debug folder. I have checked that it is actually present in the folder too.

I have exactly the same references loaded as the asp.net mvc app. Why is it failing?

Here is the code of the command line app:

using System;
using Castle.ActiveRecord;
using Castle.ActiveRecord.Framework.Config;
using ArTestCmd;

namespace ArTestCmd
{
    class MainClass
    {
        public static void Main (string[] args)
        {
            String configFile = @"/home/si/Projects/ArTestCmd/CastleAR.config";

            XmlConfigurationSource source = new XmlConfigurationSource(configFile);
            ActiveRecordStarter.Initialize(source, typeof(Pc));
            ActiveRecordStarter.UpdateSchema();

            Pc pc = new Pc();
            pc.name = "blah";
            pc.Create();

        }
    }

    [ActiveRecord]
    public class Pc : ActiveRecordBase<Pc>
    {
        [PrimaryKey]
        public int PcId { get; set; }
        [Property (NotNull=true,Unique=true)]
        public String name { get; set; }

    }
}

Here is the stack trace:

Unhandled Exception: NHibernate.HibernateException: Could not create the driver from NHibernate.Driver.MySqlDataDriver. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Configuration.ConfigurationErrorsException: Failed to find or load the registered .Net Framework Data Provider 'MySql.Data.MySqlClient'.
  at System.Data.Common.DbProviderFactories.GetFactory (System.String providerInvariantName) [0x00000] in <filename unknown>:0 
  at NHibernate.Driver.ReflectionBasedDriver..ctor (System.String providerInvariantName, System.String driverAssemblyName, System.String connectionTypeName, System.String commandTypeName) [0x00000] in <filename unknown>:0 
  at NHibernate.Driver.MySqlDataDriver..ctor () [0x00000] in <filename unknown>:0 
  at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  at System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters) [0x00000] in <filename unknown>:0 
  at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x00000] in <filename unknown>:0 
  at System.Activator.CreateInstance (System.Type type) [0x00000] in <filename unknown>:0 
  at NHibernate.Bytecode.ActivatorObjectsFactory.CreateInstance (System.Type type) [0x00000] in <filename unknown>:0 
  at NHibernate.Connection.ConnectionProvider.ConfigureDriver (IDictionary`2 settings) [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at NHibernate.Connection.ConnectionProvider.ConfigureDriver (IDictionary`2 settings) [0x00000] in <filename unknown>:0 
  at NHibernate.Connection.ConnectionProvider.Configure (IDictionary`2 settings) [0x00000] in <filename unknown>:0 
  at NHibernate.Connection.ConnectionProviderFactory.NewConnectionProvider (IDictionary`2 settings) [0x00000] in <filename unknown>:0 
  at NHibernate.Cfg.SettingsFactory.BuildSettings (IDictionary`2 properties) [0x00000] in <filename unknown>:0 
  at NHibernate.Cfg.Configuration.BuildSettings () [0x00000] in <filename unknown>:0 
  at NHibernate.Cfg.Configuration.BuildSessionFactory () [0x00000] in <filename unknown>:0 
  at Castle.ActiveRecord.Framework.SessionFactoryHolder.GetSessionFactory (System.Type type) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) Castle.ActiveRecord.Framework.SessionFactoryHolder:GetSessionFactory (System.Type)
  at Castle.ActiveRecord.Framework.SessionFactoryHolder.CreateSession (System.Type type) [0x00000] in <filename unknown>:0 
  at (wrapper synchronized) Castle.ActiveRecord.Framework.SessionFactoryHolder:CreateSession (System.Type)
  at Castle.ActiveRecord.ActiveRecordBase.InternalCreate (System.Object instance, Boolean flush) [0x00000] in <filename unknown>:0 
  at Castle.ActiveRecord.ActiveRecordBase.Create (System.Object instance) [0x00000] in <filename unknown>:0 
  at Castle.ActiveRecord.ActiveRecordBase.Create () [0x00000] in <filename unknown>:0 
  at IntervalTool.MainClass.schemaAction (System.String action, System.String filename) [0x00000] in <filename unknown>:0 
  at IntervalTool.MainClass.Main (System.String[] args) [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: NHibernate.HibernateException: Could not create the driver from NHibernate.Driver.MySqlDataDriver. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Configuration.ConfigurationErrorsException: Failed to find or load the registered .Net Framework Data Provider 'MySql.Data.MySqlClient'.
  at System.Data.Common.DbProviderFactories.GetFactory (System.String providerInvariantName) [0x00000] in <filename unknown>:0 
  at NHibernate.Driver.ReflectionBasedDriver..ctor (System.String providerInvariantName, System.String driverAssemblyName, System.String connectionTypeName, System.String commandTypeName) [0x00000] in <filename unknown>:0 
  at NHibernate.Driver.MySqlDataDriver..ctor () [0x00000] in <filename unknown>:0 
  at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  at System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters) [0x00000] in <filename unknown>:0 
  at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x00000] in <filename unknown>:0 
  at System.Activator.CreateInstance (System.Type type) [0x00000] in <filename unknown>:0 
  at NHibernate.Bytecode.ActivatorObjectsFactory.CreateInstance (System.Type type) [0x00000] in <filename unknown>:0 
  at NHibernate.Connection.ConnectionProvider.ConfigureDriver (IDictionary`2 settings) [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at NHibernate.Connection.ConnectionProvider.ConfigureDriver (IDictionary`2 settings) [0x00000] in <filename unknown>:0 
  at NHibernate.Connection.ConnectionProvider.Configure (IDictionary`2 settings) [0x00000] in <filename unknown>:0 
  at NHibernate.Connection.ConnectionProviderFactory.NewConnectionProvider (IDictionary`2 settings) [0x00000] in <filename unknown>:0 
  at NHibernate.Cfg.SettingsFactory.BuildSettings (IDictionary`2 properties) [0x00000] in <filename unknown>:0 
  at NHibernate.Cfg.Configuration.BuildSettings () [0x00000] in <filename unknown>:0 
  at NHibernate.Cfg.Configuration.BuildSessionFactory () [0x00000] in <filename unknown>:0 
  at Castle.ActiveRecord.Framework.SessionFactoryHolder.GetSessionFactory (System.Type type) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) Castle.ActiveRecord.Framework.SessionFactoryHolder:GetSessionFactory (System.Type)
  at Castle.ActiveRecord.Framework.SessionFactoryHolder.CreateSession (System.Type type) [0x00000] in <filename unknown>:0 
  at (wrapper synchronized) Castle.ActiveRecord.Framework.SessionFactoryHolder:CreateSession (System.Type)
  at Castle.ActiveRecord.ActiveRecordBase.InternalCreate (System.Object instance, Boolean flush) [0x00000] in <filename unknown>:0 
  at Castle.ActiveRecord.ActiveRecordBase.Create (System.Object instance) [0x00000] in <filename unknown>:0 
  at Castle.ActiveRecord.ActiveRecordBase.Create () [0x00000] in <filename unknown>:0 
  at IntervalTool.MainClass.schemaAction (System.String action, System.String filename) [0x00000] in <filename unknown>:0 
  at IntervalTool.MainClass.Main (System.String[] args) [0x00000] in <filename unknown>:0 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T19:44:50+00:00Added an answer on May 26, 2026 at 7:44 pm

    Figured it out. This turned out to be a case sensitive issue, and it was nothing really to do with castle AR or NHibernate.

    When I tried using the MySql.Data assembly without activeRecord, it gave me a file not found exception, showing that the assembly name as MySql.Data.dll. I changed the name of the dll from mysql.data.dll to MySql.Data.dll and it worked.

    Why the assembly continues to work in the asp.net mvc app with all lower case is a mystery to me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app, modelled on the one from Apress Pro ASP.NET MVC that
I am playing around with Castle ActiveRecord and noticed that the download included the
Playing with a Mobile application in ASP.NET MVC4 beta, using great that article ,
I have been playing around with the XamlAsyncController , which is based on ASP.NET
Playing around with MongoDB and NoRM in .NET. Thing that confused me - there
Playing around with customizing the appearance of the Wizard control in ASP.Net, and I've
Im playing a little bit with heavy-client app. Imagine I have this model: class
While playing around with one-to-one associations in castle activerecord I stumbled upon the following
Playing with Disqus for commenting, but the problem is that we have a Silverlight
Hallo i am currently playing around with castle projects ActiveRecord and the remoting facility.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.