2010-11-29 8 views
6

Fluent NHibernate (모든 NHibernate 형식)에 대한 첫 번째 프로젝트를 시험 중입니다. 나는 다음과 같은 예외에 출마로 세션 팩토리 객체를 생성하는 시점 과거를 얻을 수 없었습니다 : 나는 최신 FluentNHibernate 바이너리를 사용하고Fluent NHibernate가 SQLCE를 사용하여 세션 팩토리를 생성하지 못했습니다.

InnerException: NHibernate.HibernateException 
         Message=The IDbCommand and IDbConnection implementation in the assembly System.Data.SqlServerCe could not be found. Ensure that the assembly System.Data.SqlServerCe is located in the application directory or in the Global Assembly Cache. If the assembly is in the GAC, use <qualifyAssembly/> element in the application configuration file to specify the full name of the assembly. 
         Source=NHibernate 
         StackTrace: 
          at NHibernate.Driver.ReflectionBasedDriver..ctor(String driverAssemblyName, String connectionTypeName, String commandTypeName) 
          at NHibernate.Driver.SqlServerCeDriver..ctor() 
         InnerException: 

. VS 2010, Window 7 x64. System.Data.SqlServerCe 어셈블리를 "Copy Local"로 설정하여 프로젝트의 대상 플랫폼을 x86으로 변경했습니다.

유창 설정은 다음과 같습니다

var config = Fluently.Configure() 
         .Database(MsSqlCeConfiguration.Standard.ShowSql().ConnectionString(cnxString)) 
         .Mappings(m => m.FluentMappings.AddFromAssemblyOf<SyncContract>()); 

if (!File.Exists(dbPath)) 
{ 
    var engine = new System.Data.SqlServerCe.SqlCeEngine(cnxString); 
    engine.CreateDatabase(); 

    config.ExposeConfiguration(c => new SchemaExport(c).Create(false, true)); 
} 
return config; 

참고 : engine.CreateDatabase()는 작품을 잘.

도움이나 아이디어를 알려주세요.

답변

7

좋아, 알아 냈어.

로컬 복사는 내가 사용했던 테스트 프로젝트에 적용되지 않았으므로 결과 프로젝트의 bin 폴더에 복사되지 않았습니다. 모든 라이브러리를 테스트 프로젝트에 대한 참조로 추가하고이를 작동시키기 위해 copy local을 설정했습니다.

+0

나는 프로젝트를 x86으로 지정할 필요가 없었습니다. 나는 "모든 CPU"를 타겟으로하는 코드를 실행할 수 있었다. – Sameera

+1

나는 같은 문제를 겪었다. "로컬 복사"는 TFS에서 실행되는 테스트에 대해 작동하지 않았습니다. 나는 [테스트 설정] (http://msdn.microsoft.com/en-us/library/ee256991.aspx)을 사용하여 모든 올바른 라이브러리를 추가해야했습니다. – mathieu

관련 문제