开发者

Object reference not set to an instance of an object Error

开发者 https://www.devze.com 2022-12-24 04:51 出处:网络
I\'m trying to save text fields in MySql using NHibernate in Asp.Net frame work. But while executing this I got the error\"Object reference not set to an instance of an object\". If anyone knew help m

I'm trying to save text fields in MySql using NHibernate in Asp.Net frame work. But while executing this I got the error"Object reference not set to an instance of an object". If anyone knew help me...

Here is the code.

if (!Page.IsPostBack) 
{
   IList siteList; 
   ISessionFactory factory = new NHibernate.Cfg.Configuration().Configure().BuildSessionFactory(); 
   using (ISessi开发者_高级运维on session = factory.OpenSession()) 
   {
      ICriteria sc = session.CreateCriteria(typeof(Employee )); 
      siteList = sc.List(); 
      session.Close(); 
   } 
   factory.Close(); 
}


**Can you post a stack trace? And a description of how you are configuring **

If i had to take a guess the crash is in (because of missing/incorrect configuration information):

new NHibernate.Cfg.Configuration().Configure().Build().SessionFactory()

0

精彩评论

暂无评论...
验证码 换一张
取 消