TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Smart Lucky
NA
555
637.7k
Connection Database Using NHibernate getting Exception
Jul 23 2013 1:09 AM
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.
Reply
Answers (
2
)
getting error in datamodel in mvc4
Many to many inserting values ito DB in Ado.net entity frame