开发者

FluentNHibernate CreateSessionFactory error

I cant solve the problem: Try to execute tutorial from http://wiki.fluentnhibernate.org/Getting_started#Your_first_project error occur in CreateSessionFactory() method:

 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

I use Windows 7, Visual Studio 29010, FluentNHibernate 1.2.)


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

The problem is the fact that you've named your project fluentNhibernate. Name it something else (TestProject). I've actually seen this same problem in numerous posts on SO.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜