2

Here is my Hibernate settings:

FluentConfiguration configuration = Fluently.Configure()
            .Database(PostgreSQLConfiguration.Standard.ConnectionString(c => c
                    .Host("localhost")
                    .Port(5432)
                    .Database("PEDAux")
                    .Username("ped_admin")
                    .Password("xxxxx"))
                .ShowSql)
            .Mappings(m => m.FluentMappings
                .AddFromAssembly(Assembly.GetExecutingAssembly())
                .Conventions.Add<TableNameConvention>()
                .Conventions.Add<ColumnNameConvention>()
            )
            .ExposeConfiguration(x =>
            {
                // TODO: Not yet sure what to put in here
            });

        return configuration.BuildSessionFactory();

I am getting the following Error:

Inner Exception 1: HibernateException: Could not create the driver from NHibernate.Driver.NpgsqlDriver, NHibernate, Version=5.2.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4.

Inner Exception 2: TargetInvocationException: Exception has been thrown by the target of an invocation.

Inner Exception 3: ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.

Same set of config seems to work when I am using SQLServer. Of course for SQL Server I am using the SQLServer config object. Project is running on .NET Version=v4.7.2".

Edwin Bautista
  • 463
  • 3
  • 17

1 Answers1

0

Per the NpgsqlDriver docs:

In order to use this Driver you must have the Npgsql.dll Assembly available for NHibernate to load it.

Based on the error, it appears you have not installed Npgsql.dll assembly, or if you have, it has not been referenced in your project.

kaliatech
  • 17,579
  • 5
  • 72
  • 84
  • I am pretty sure that I have npgsql.dll (v 4.0.6) installed because I used Nuget package manager for this. And it is indeed properly referenced on the project. – Edwin Bautista Apr 27 '19 at 14:15
  • In that case, I think more info will be needed in your question before someone can help you. The error seemingly indicates that it is something related to the driver reference itself. Other things to check: https://stackoverflow.com/questions/13309761/could-not-create-the-driver-from-nhibernate-driver-npgsqldriver and https://stackoverflow.com/questions/21157069/unable-to-find-the-requested-net-framework-data-provider-it-may-not-be-install – kaliatech Apr 28 '19 at 05:05