I am trying to automate the ability of selfish NHibernate, and the same code that is clear ClassMap Configuration is failing when I try to move it to automapping when creating
SessionFactory .
Here is the code:
Public stable ISessionFactory GetSessionFactory () {if (_sessionFactory == faucet) {_sessionFactory = Fluently.Configure (). Database (MsSqlConfiguration.MsSql2008 ConnectionString (c = & gt; c.FromConnectionStringWithKey ("DB")) // It works with: / / .appings (M => m.FluentMappings.AddFromAssemblyOf & lt; Customer & gt; )) // It failed with: mappings (m = & gt; m.AutoMappings.Add (AutoMap.AssemblyOf & lt; Customer & gt; ())). BuildSessionFactory (); Return _sessionFactory; } The error I get is:
An invalid or incomplete configuration was used during a session-file creation. Check out InnerException for a more detailed description, more detail.
I have calculation = 0 for possible reasons and the internal exception is the same.
In FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory () D: :: \ creates \ FluentNH-v1.x-NH3 \ src \ above
refers to stacktrace FluentNHibernate \ Cfg \ FluentConfiguration.cs: line 113
It seems that I have tried to do everything to make it work, and the closest one came only to get started could not find persister ... error when I tried to use the session, and I do not even remember how I was able to do this.
Using NHibernate 3.0, Build # 694 with SQL 2008 Database. Any thoughts that I am doing wrong?
It was a dumb error that Eliot's comments helped me that I had an enum type in the database An EnumConvention was set up as an integer, and NHibernate was choking on it. I asked an EnumConvention to setup this way:
_sessionFactory = Fluently.Configure (). Database (MsSqlConfiguration MsSql2008.ConnectionString (c = & gt; c.FromConnectionStringWithKey ("DB")). Mappings (M => m.AutoMappings.Add (AutoMap.AssemblyOf & lt; Customer & gt; .. (New AutomapConfiguration () ) Conventions Setup (c = & gt; {c.Add & lt; PrimaryKeyConvention & gt; (); c.Add & Lt; EnumConvention & gt; (); c.Add & LT; CascadeAllConvention & gt; ();}) .IgnoreBase (typeof (EntityBase & lt; & gt;)) .overrideAll (map = & gt; map.IgnoreProperty "If there is"))) .BuildSessionFactory (); This conference is here:
Public category EnumConvention: IUserTypeConvention {accept public void (IAcceptanceCriteria & lt; IPropertyInspector & gt; Criteria) {Criteria. Expect (x = & gt; X. Property.property type .asnem); } Enforce public nullity (IPProtest target goal) {target.CustomType (target.Property.PropertyType); }}
Comments
Post a Comment