Actually, I got it working. The problem is from my mapping. So, it has nothing to do with 'Database was not configured through Database method.'
If you see the same error message, probably check your mapping before trying to configure Database through Database method ... Harry On Thu, Apr 16, 2009 at 8:42 AM, harrychou <harryc...@gmail.com> wrote: > > I have an existing application and I would like to move it to fluent > interface. > > I want to keep NHibernate config file since I might need to change > databases when I move from dev to QA or production server. > > My mapping class and all HBM files are in Repository assembly. Here is > the code I am trying to export the schema. The code generate nothing. > > ====== > > var sb = new StringBuilder(); > TextWriter output = new StringWriter(sb); > > FluentConfiguration fcfg = Fluently.Configure(new > Configuration().Configure("hibernate.cfg.xml")) > .Mappings(m => > { > > m.FluentMappings.AddFromAssemblyOf<Repository>(); > m.HbmMappings.AddFromAssemblyOf<Repository> > (); > }); > > fcfg.ExposeConfiguration(c => new SchemaExport(c).Execute > (true, false, false, false, null, output)); > > Console.WriteLine(sb.ToString()); > > ====== > > When I try to call BuildSessionFactory() on fcfg, I got the following > error: > > ====== > > Benelogic.BBI.BI_Portal.UnitTest.DataAccess.ClientDataAccessTest > (TestFixtureSetUp) : > FluentNHibernate.Cfg.FluentConfigurationException : An invalid or > incomplete configuration was used while creating a SessionFactory. > Check PotentialReasons collection, and InnerException for more detail. > > * Database was not configured through Database method. > > ----> System.ApplicationException : Error while trying to build the > Mapping Document for 'Benelogic.BBI.Model.Client' > ----> NHibernate.MappingException : Could not compile the mapping > document: (XmlDocument) > ----> System.IndexOutOfRangeException : Index was outside the bounds > of the array. > > ====== > > Does that mean I need to setup Database by calling database method? Or > I have error in my mapping code? I am stuck and don't know what to do > next. Any help is much appreciated. > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To post to this group, send email to fluent-nhibernate@googlegroups.com To unsubscribe from this group, send email to fluent-nhibernate+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en -~----------~----~----~----~------~----~------~--~---