2011-10-13 10 views
0

bltoolkit, T4 템플릿 및 postgreSQL을 사용하여 데이터 레이어를 생성하려고합니다. 나는 documentation에 의해 제안 하나를 기반으로 내 T4 템플릿을 실행하는 예외가 나타납니다 모든 라이브러리를 참조하여, MSSQL에 연결하는 작품을 좋아하고, 처음에는 모두가 올바른 보이지만,BLToolkit + T4 생성 + PostgreSQL 데이터베이스가 가능합니까?

Error 5 Running transformation: System.ArgumentNullException: Value cannot be null. 
Parameter name: type, at System.Activator.CreateInstance(Type type, Boolean nonPublic) 
(...) 

VSNET08에서 작업을 내가 뭔가를 남겨 ...

이 내 .TT 템플릿입니다 :

<#@ template language="C#v3.5" hostspecific="True" #> 
<#@ output extension=".generated.cs" #> 
<#@ include file="BLToolkit.ttinclude" #> 
<#@ include file="PostgreSQL.ttinclude" #> 
<#@ include file="PluralSingular.ttinclude" #> 
<# 
    ConnectionString = "<connection string to postgresql database"; 
    DataProviderAssembly = @"..\References\Npgsql.dll"; 
    GenerateModel(); 
#> 

답변

1

대부분의 경우 T4가 Npgsql.dll을 찾을 수 없습니다. T4가 실행 중일 때 현재 디렉토리는 프로젝트 위치가 아닙니다. 따라서 전체 경로를 시도해야합니다.

또 다른 문제는 어셈블리에 의존합니다. 템플릿에 다음을 추가하십시오.

System.Reflection.Assembly.LoadFile(@"...PostgreSqlLocation...\Mono.Security.dll"); 
+0

해결 된 PostgreSQL .Net 드라이버. T4는 훌륭한 도구이지만 때로는 자세한 오류 정보를 얻기가 어렵습니다 ... – MoveTheBits