我正在編寫使用postgres數據庫的代碼。這段代碼已經使用了oracle特定的函數,並添加了一些函數來訪問postgres表。需要構建的版本僅使用postgres功能,不需要oracle的代碼行,因此不需要ODAC。如何避免在c#.net中編譯代碼的ODAC許可項目
http://www.oracle.com/technetwork/topics/dotnet/utilsoft-086879.html
有喜歡加入條件編譯爲C#所以不執行Oracle專用代碼Postgres的選項。這樣做不會在已編譯的dll中添加基於ODAC的代碼部分,因此不需要ODAC,但這是唯一的方法。正如我所說的那樣,應用程序中有很多項目,並且執行條件編譯會創建大量額外的代碼。
或者還有什麼可以避免ODAC許可的其他選擇。
感謝,
function GetData()
{
if(Postgres flag){
// code for using OracleClientFactory and initlizing the oraclecommand
}
else if(Oracle flag)
{
// code for using postgres and initlizing the its command object
}
}
// code to assign query to command object and execute the query
// return the resluts
catch(){}
finally{//dispoing the objects}
}
}