nhibernatenhibernate-envers

NHibernate Envers IntegrateWithEnvers error


Receiving no extension method found

'NHibernate.Cfg.Configuration' does not contain a definition for 'IntegrateWithEnvers' and no extension method 'IntegrateWithEnvers' accepting a first argument of type 'NHibernate.Cfg.Configuration' could be found (are you missing a using directive or an assembly reference?)

I am using NHibernate Envers 2, NHibernate 4 and FluentNHibernate 1.4 with asp.net 4.5.

My Configuration is

 using CancerConnect.Domain;
 using CancerConnect.Infrastructure.Conventions;
 using FluentNHibernate.Automapping;
 using FluentNHibernate.Cfg;
 using FluentNHibernate.Cfg.Db;
 using System;


var enversConf = new NHibernate.Envers.Configuration.Fluent.FluentConfiguration();
       enversConf.Audit<Users>();

var cfg = Fluently.Configure()
             .Database(MsSqlConfiguration.MsSql2008.ConnectionString(p => p.FromConnectionStringWithKey("dbConnectionString")))
             .Mappings(m => m.AutoMappings.Add(persistenceModel))
             .ExposeConfiguration(conf => 
             {
                conf.IntegrateWithEnvers(enversConf); 
             })
            .BuildConfiguration();

Am I missing anything


Solution

  • The extension method IntegrateWithEnvers is defined in the namespace NHibernate.Cfg see here.

    So be sure to add the following using:

    using NHibernate.Cfg;
    

    And you will have access to the extension method.