this is ASP.NET MVC 5 Sample App. trying to learn MVC's module NHibernate.
if I understand right. hibernate.cfg.xml file is not neccessary if settings coded in web.config as a configsection.
is xmlns version is wrong ? or do you see something misspelled ? so why NHibernate asks hibernate.cfg.xml even if web.config configured? (thanks)
<configSections>
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler,NHibernate" />
...
<hibernate-configuration xmlns="urn:nhibernate-configuration-version-2.2">
<session-factory>
<property name="dialect">NHibernate.Dialect.MySQLDialect</property>
<property name="connection.driver_class">NHibernate.Driver.MySqlDataDriver</property>
<property name="connection.connection_string_name">LocalMySqlServer</property>
</session-factory>
</hibernate-configuration>
getting this error:
Could not find file '...\Visual Studio 2013\Projects\bin\Debug\hibernate.cfg.xml'.
and DB Class static member (which used once in global.asax.cs Application_Start method) is:
public static void Configure()
{
var config = new Configuration();
config.Configure();
var mapper1 = new ModelMapper();
mapper.AddMapping<UserMap>();
config.AddMapping(mapper.CompileMappingForAllExplicitlyAddedEntities());
_sessionFactory = config.BuildSessionFactory();
// _session factory is a class member defined as
// private static ISessionFactory _sessionFactory;
}
NHibernate 4.0.3.4000 installed [using nuget]
hibernate-configurationinstead ofhybernate-configuration.