llblgen v5.3 ,nhiberanate v4.x and fluentNhibernate v2.0.3

Posts   
 
    
alonsoChen
User
Posts: 30
Joined: 27-Nov-2017
# Posted on: 02-Feb-2018 07:09:27   

compile error: in sessionManager.cs

static SessionManager()
        {
            _sessionFactory = Fluently.Configure()
                .Database(FirebirdConfiguration //line 23
                            .ConnectionString(c => c.FromConnectionStringWithKey("ConnectionString.Firebird (Firebird.NET)")))
                .Mappings(m => m.FluentMappings.AddFromAssembly(typeof(SessionManager).Assembly))
                .BuildSessionFactory();
        }

Severity Code Description Project File Line Suppression State Error CS0120 An object reference is required for the non-static field, method, or property 'PersistenceConfiguration<FirebirdConfiguration, ConnectionStringBuilder>.ConnectionString(Action<ConnectionStringBuilder>)' invoiceFirebird.Persistence C:\Users\alonso_c.PARTNER\Downloads\Firebird-2.5.7.27050-0_Win32_embed\Database\Persistence\SessionManager.cs 23 Active

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 02-Feb-2018 07:27:19   
  • What LLBLGen designer version are you using?
  • Did you install the FluentNHibernate packages from nuget? (Ref...).
  • What were the steps you walk through this point to end with that code and compilation error?

Also, FirebirdConfiguration is not a static class, which means that you have to create an instance of that class (hence the error).

var fb = new FirebirdConfiguration();
// use fb in your code;
David Elizondo | LLBLGen Support Team
alonsoChen
User
Posts: 30
Joined: 27-Nov-2017
# Posted on: 02-Feb-2018 07:35:48   

daelmo wrote:

  • What LLBLGen designer version are you using?
  • Did you install the FluentNHibernate packages from nuget? (Ref...).
  • What were the steps you walk through this point to end with that code and compilation error?

Also, FirebirdConfiguration is not a static class, which means that you have to create an instance of that class (hence the error).

var fb = new FirebirdConfiguration();
// use fb in your code;

What LLBLGen designer version are you using? v5.3

Did you install the FluentNHibernate packages from nuget? yes , version as title

What were the steps you walk through this point to end with that code and compilation error? use add nhiberanate and fluentNhibernate from nuget then compile

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 02-Feb-2018 16:52:00   

Could you please right-click on the FirebirdConfiguration and click on "Go to Definition"? The please post the namespace and class definition.

Namespace should read: "FluentNHibernate.Cfg.Db"

Under Assembly: "FluentNHibernate"

alonsoChen
User
Posts: 30
Joined: 27-Nov-2017
# Posted on: 12-Feb-2018 10:28:00   

Walaa wrote:

Could you please right-click on the FirebirdConfiguration and click on "Go to Definition"? The please post the namespace and class definition.

Namespace should read: "FluentNHibernate.Cfg.Db"

Under Assembly: "FluentNHibernate"

region Assembly FluentNHibernate, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null

// C:\Users\alonso_c.PARTNER\Documents\job\source code\webApiForPosAp\webApi\packages\FluentNHibernate.2.0.3.0\lib\net40\FluentNHibernate.dll

endregion

namespace FluentNHibernate.Cfg.Db { public class FirebirdConfiguration : PersistenceConfiguration<FirebirdConfiguration> { public FirebirdConfiguration(); } }

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 12-Feb-2018 16:22:08   

It's a bug in the template. There's an inconsistency in the Configuration classes in FluentNhibernate: all databases use static properties (and the generated code works OK), however in the FirebirdConfiguration, there's no dialect, so there's no static property.

We'll fix this in the template.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 13-Feb-2018 10:37:09   

This has been fixed in the 5.3.4 hotfix which is now available. It will now properly generate the right code for Firebird.

Frans Bouma | Lead developer LLBLGen Pro