[英]Parameter discovery is not supported for connections using GenericDatabase.
我一直在嘗試創建自己的DbProvider並使用EnterpriseLibrary對其進行配置,但是我正在解決以下問題
使用GenericDatabase的連接不支持參數發現。 您必須明確指定參數,或將連接配置為使用從支持參數發現的數據庫派生的類型。
我已經創建了實現DbConnection的Connection類以及其他實現DbCommand等的類
我重寫了DbConnection類和我不知道實現的方法我拋出了未實現的異常
public override string Database
{
get
{
throw new NotImpelmentedException();
}
}
並且我創建了如下的企業庫連接
public Database GetConnection()
{
CustomDbProviderFactory obj = new CustomDbProviderFactory();
GenericDatabase db = new GenericDatabase("server=****;Request Timeout=3000000;", obj);
return db;
}
但是當我用連接字符串和命令執行DataReader時,我遇到了問題
我已經解決了這個問題,在使用通用數據庫對象時,我是這樣使用的
db.ExecuteReader("Select * from employees");
相反,它應該是
db.ExecuteReader(CommandType.Text,"Select * from employees");
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.