Control (Solution)
AppDB (Project)
Classes (Folder)
Piece.cs
Mapping (Folder)
PieceMap.cs
나는 다음과 같은 지침
Configuration hibernateConfiguration = new Configuration();
hibernateConfiguration.SetProperty("connection.connection_string", "server=(local);Data Source="+pRutaDB);
hibernateConfiguration.AddAssembly("AppDB.Mapping.PieceMap");
hibernateConfiguration = hibernateConfiguration.Configure();
NHibernate.ISessionFactory sessionFactory = hibernateConfiguration.BuildSessionFactory();
NHibernate.ISession session = sessionFactory.OpenSession();
NHibernate.ITransaction tr = session.BeginTransaction();
Piece p = new Piece();
p.name = "Test Piece";
pSession.SaveOrUpdate(p);
tr.Commit();
그러나 tr.Commit() 명령을하고 런타임에 어셈블리 맵을 Visual Studio에서 다음과 같은 구조를 추가 한 도착하면 다음 오류가 표시됩니다.
Error: NHibernate.MappingException: Could not add assembly AppDb.Mapping.PieceMap ---> System.IO.FileNotFoundException
누구나 실행 중에 어셈블리를 추가하는 방법을 알려줄 수 있습니다. 시각?
감사합니다.
편집 :
가NHibernate.MappingException: No persister for: GeometriaDB.Clases.Proyecto
이제 왜 오류가 표시됩니다 : 명령어와 오류는 다음과 같은 오류가 나타납니다 이제
hibernateConfiguration.AddAssembly(typeof(GeometriaDB.Mapping.PieceMap).Assembly);
을 변경?
hibernateConfiguration.AddAssembly("AppDB.Mapping.PieceMap.dll");
을 또한 같은 디렉토리에 있어야합니다 DLL 또는 어셈블리의 전체 경로를 표시해야합니다 :
당신의 다음 오류가 더 나은, 첫 번째로 할 그것을 위해 전용 질문을 아마 아무 상관이 없습니다. –
처음에는 [이쪽] (http://stackoverflow.com/q/57804/1178314)과 같이 아직 답장되어 있지 않은지 확인하십시오. –