Connection Database Using NHibernate getting Exception
Hi dudes i am trying to connect database using NHibernate in this way but unfortunately getting exception, can nay one help me how can i solve this.
(using vs 2012)
private static ISessionFactory SessionFactory
{
get
{
if (_sessionFactory == null)
InitilizeSessionFactory();
return _sessionFactory;
}
}
public static string localDb = @"Data Source=.;Initial Catalog=23;Integrated Security=True";
private static void InitilizeSessionFactory()
{
_sessionFactory = Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2008
.ConnectionString(localDb)
).Mappings(c =>
c.FluentMappings
.AddFromAssemblyOf<Student>())
.ExposeConfiguration(cfg => new SchemaExport(cfg)
.Create(false, false))
.BuildSessionFactory();
//.Mappings(m =>
// m.FluentMappings
// .AddFromAssemblyOf<Student>())
//.ExposeConfiguration(cfg => new SchemaExport(cfg)
//.Create(false, false))
//.BuildSessionFactory();
///////////////Exception//////////////
An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.