2013-04-15 46 views
0

我得到BuildSessionFactory空異常。Nhibernate BuildSessionFactory空異常

使用Nhibernate 3.3.3.4000,.NET 4.5,MVC 4和;

ISessionFactory sessionFactory = new Configuration().Configure().BuildSessionFactory(); 

當我嘗試這個代碼塊即時通知空例外。試了幾次安裝nuget包並檢查了web.config。沒有改變。

任何人都可以幫到我嗎?

編輯-1異常的堆棧跟蹤

at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) 
    at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() 
    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
    at System.Threading.ThreadHelper.ThreadStart() 

at NHibernate.Engine.NamedSQLQueryDefinition..ctor(String query, INativeSQLQueryReturn[] queryReturns, IList`1 querySpaces, Boolean cacheable, String cacheRegion, Int32 timeout, Int32 fetchSize, FlushMode flushMode, Nullable`1 cacheMode, Boolean readOnly, String comment, IDictionary`2 parameterTypes, Boolean callable) 
    at NHibernate.Cfg.XmlHbmBinding.NamedSQLQueryBinder.<>c__DisplayClass1.<AddSqlQuery>b__0(IDictionary`2 param0) 
    at NHibernate.Cfg.Configuration.SecondPassCompile() 
    at NHibernate.Cfg.Configuration.BuildSessionFactory() 

謝謝了。

+0

發佈異常的堆棧跟蹤 –

+0

您可以將答案發布爲答案並將其標記爲正確嗎? – Digbyswift

回答

1

我找到了解決方案!在我的模型映射中,我留下了空白的一個SQL查詢。 :)