2011-09-01 41 views
0

我不能解決的問題:嘗試從http://wiki.fluentnhibernate.org/Getting_started#Your_first_project 誤差執行教程發生在CreateSessionFactory()方法:FluentNHibernate CreateSessionFactory錯誤

FluentNHibernate.Cfg.FluentConfigurationException: An invalid or incomplete conf 
iguration was used while creating a SessionFactory. Check PotentialReasons colle 
ction, and InnerException for more detail. 

---> FluentNHibernate.Cfg.FluentConfigurationException: An invalid or incomplet 
e configuration was used while creating a SessionFactory. Check PotentialReasons 
collection, and InnerException for more detail. 

---> NHibernate.MappingException: Could not compile the mapping document: (XmlD 
ocument) ---> NHibernate.MappingException: persistent class fluentNHibernateexam 
ple.Entities.Employee, fluentNHibernate, Version=1.0.0.0, Culture=neutral, Publi 
cKeyToken=null not found ---> System.IO.FileLoadException: Could not load file o 
r assembly 'fluentNHibernate, Version=1.0.0.0, Culture=neutral, PublicKeyToken=n 
ull' or one of its dependencies. The located assembly's manifest definition does 
not match the assembly reference. (Exception from HRESULT: 0x80131040) 
    at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, 
Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, Bool 
ean loadTypeFromPartialName, ObjectHandleOnStack type) 
    at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, 
Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, Boolean l 
oadTypeFromPartialName) 
    at System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean 
ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) 
    at System.Type.GetType(String typeName) 
    at NHibernate.Util.ReflectHelper.TypeFromAssembly(AssemblyQualifiedTypeName n 
ame, Boolean throwOnError) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Util\Ref 
lectHelper.cs:line 291 
    at NHibernate.Cfg.XmlHbmBinding.Binder.ClassForFullNameChecked(String fullNam 
e, String errorMessage) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Cfg\XmlHbmB 
inding\Binder.cs:line 99 
    --- End of inner exception stack trace --- 
    at NHibernate.Cfg.XmlHbmBinding.Binder.ClassForFullNameChecked(String fullNam 
e, String errorMessage) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Cfg\XmlHbmB 
inding\Binder.cs:line 103 
    at NHibernate.Cfg.XmlHbmBinding.ClassBinder.BindClass(IEntityMapping classMap 
ping, PersistentClass model, IDictionary`2 inheritedMetas) in d:\CSharp\NH\NH\nh 
ibernate\src\NHibernate\Cfg\XmlHbmBinding\ClassBinder.cs:line 35 
    at NHibernate.Cfg.XmlHbmBinding.RootClassBinder.Bind(HbmClass classSchema, ID 
ictionary`2 inheritedMetas) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Cfg\Xml 
HbmBinding\RootClassBinder.cs:line 19 
    at NHibernate.Cfg.XmlHbmBinding.MappingRootBinder.AddEntitiesMappings(HbmMapp 
ing mappingSchema, IDictionary`2 inheritedMetas) in d:\CSharp\NH\NH\nhibernate\s 
rc\NHibernate\Cfg\XmlHbmBinding\MappingRootBinder.cs:line 42 
    at NHibernate.Cfg.XmlHbmBinding.MappingRootBinder.Bind(HbmMapping mappingSche 
ma) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Cfg\XmlHbmBinding\MappingRootBi 
nder.cs:line 29 
    at NHibernate.Cfg.Configuration.AddDeserializedMapping(HbmMapping mappingDocu 
ment, String documentFileName) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Cfg\ 
Configuration.cs:line 522 
    --- End of inner exception stack trace --- 
    at NHibernate.Cfg.Configuration.LogAndThrow(Exception exception) in d:\CSharp 
\NH\NH\nhibernate\src\NHibernate\Cfg\Configuration.cs:line 342 
    at NHibernate.Cfg.Configuration.AddDeserializedMapping(HbmMapping mappingDocu 
ment, String documentFileName) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Cfg\ 
Configuration.cs:line 530 
    at NHibernate.Cfg.Configuration.ProcessMappingsQueue() in d:\CSharp\NH\NH\nhi 
bernate\src\NHibernate\Cfg\Configuration.cs:line 1832 
    at NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream, String 
name) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Cfg\Configuration.cs:line 630 

    at NHibernate.Cfg.Configuration.AddDocument(XmlDocument doc, String name) in 
d:\CSharp\NH\NH\nhibernate\src\NHibernate\Cfg\Configuration.cs:line 481 
    at NHibernate.Cfg.Configuration.AddDocument(XmlDocument doc) in d:\CSharp\NH\ 
NH\nhibernate\src\NHibernate\Cfg\Configuration.cs:line 455 
    at FluentNHibernate.PersistenceModel.Configure(Configuration cfg) 
    at FluentNHibernate.Cfg.MappingConfiguration.Apply(Configuration cfg) 
    at FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration() 
    --- End of inner exception stack trace --- 
    at FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration() 
    at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory() 
    --- End of inner exception stack trace --- 
    at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory() 
    at Examples.FirstProject.Program.CreateSessionFactory() in C:\_Learning\ORM\f 
luentNHibernate\Program.cs:line 120 

我使用Windows 7時,Visual Studio 29010,FluentNHibernate 1.2)

+0

它看起來像你的應用程序期待fluentNHibernate DLL的版本1.0.0.0,或者它丟失或者你正在使用更新版本的dll – Waqas

+0

今天我已經從http://fluentnhibernate.org/downloads/releases/fluentnhibernate下載fluentnHibernate -NH3.1-1.2.zip –

回答

1

in C:\_Learning\ORM\fluentNHibernate\Program.cs:line 120

問題是,您已將您的項目命名爲fluentNhibernate。把它命名爲別的東西(TestProject)。我已經在SO上的許多帖子中看到過這個相同的問題。

+0

我的程序集名稱是流利的NHibernate(((( –

+0

但現在我無法從NHibernate.Driver.SQLite20Driver,NHibernate,Version = 3.1.0.4000,Culture = neutral,PublicKeyToken = aa95f207798dfdb4創建驅動程序。 –

+1

http://stackoverflow.com/questions/4214700/could-not-create-the-driver-from-nhibernate-driver-sqlite20driver http://stackoverflow.com/questions/6124710/could-not-create-the -driver-from-nhibernate-driver-sqlite20driver –

相關問題