本文整理汇总了C#中DbCommand.ShouldBeInstanceOf方法的典型用法代码示例。如果您正苦于以下问题:C# DbCommand.ShouldBeInstanceOf方法的具体用法?C# DbCommand.ShouldBeInstanceOf怎么用?C# DbCommand.ShouldBeInstanceOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DbCommand
的用法示例。
在下文中一共展示了DbCommand.ShouldBeInstanceOf方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteDataTableAsList
/// <summary>
/// 여러 ResultSet을 반환할 수 있으므로, DataTable의 컬렉션으로 반환합니다.
/// </summary>
public override IList<DataTable> ExecuteDataTableAsList(DbCommand cmd, int firstResult, int maxResults,
params IAdoParameter[] parameters) {
cmd.ShouldBeInstanceOf<MySqlCommand>("cmd");
return With.TryFunctionAsync(() => Db.ExecuteDataTableAsListAsync((MySqlCommand)cmd,
firstResult,
maxResults,
parameters)
.Result,
() => new List<DataTable>());
}
示例2: ExecuteScalarInternal
/// <summary>
/// 지정된 Command의 ExecuteScalar 메소드를 실행합니다.
/// </summary>
/// <param name="cmd">실행할 Command 객체</param>
/// <returns></returns>
protected override object ExecuteScalarInternal(DbCommand cmd) {
cmd.ShouldBeInstanceOf<MySqlCommand>("cmd");
return With.TryFunctionAsync(() => Db.ExecuteScalarAsync((MySqlCommand)cmd).Result, () => null);
}
示例3: ExecuteReaderInternal
/// <summary>
/// 지정된 Command의 ExecuteReader 메소드를 실행합니다.
/// </summary>
/// <param name="cmd"></param>
/// <returns></returns>
protected override IDataReader ExecuteReaderInternal(DbCommand cmd) {
cmd.ShouldBeInstanceOf<MySqlCommand>("cmd");
return With.TryFunctionAsync(() => Db.ExecuteReaderAsync((MySqlCommand)cmd).Result, () => (IDataReader)null);
}
示例4: ExecuteNonQueryInternal
/// <summary>
/// 지정된 Command의 ExecuteNonQuery 메소드를 실행합니다.
/// </summary>
/// <param name="cmd">실행할 Command 객체</param>
/// <returns></returns>
protected override int ExecuteNonQueryInternal(DbCommand cmd) {
cmd.ShouldBeInstanceOf<MySqlCommand>("cmd");
return With.TryFunctionAsync(() => Db.ExecuteNonQueryAsync((MySqlCommand)cmd).Result, () => -1);
}