如何使用具有通用数据库的Enterprise库获取存储过程的参数
当我使用它时,我得到以下exception
Parameter discovery is not supported for connections using GenericDatabase. You must specify the parameters explicitly, or configure the connection to use a type deriving from Database that supports parameter discovery.
除了这个程序之外还有正确的方法吗?
编辑
Database db = CustomDbFactory.CreateDataBase(connStrName); DbCommand command = db.DbProviderFactory.CreateCommand(); command.CommandText = @spName; command.CommandType = CommandType.StoredProcedure; db.DiscoverParameters(command); ...
仅此SqlDatabase
对象仅支持此function。 因此,我不得不在GenericDatabase
上调用DiscoverParameters
,而是从SqlDatabase
调用它。具体问题。