本文整理汇总了C#中Csla.Data.SafeDataReader.ReadDateTime方法的典型用法代码示例。如果您正苦于以下问题:C# SafeDataReader.ReadDateTime方法的具体用法?C# SafeDataReader.ReadDateTime怎么用?C# SafeDataReader.ReadDateTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Csla.Data.SafeDataReader
的用法示例。
在下文中一共展示了SafeDataReader.ReadDateTime方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FetchPublishHistory
/// <summary>
/// Retrieves publish history.
/// </summary>
/// <param name="processId">The process id.</param>
/// <param name="numberOfRecords">The number of records.</param>
/// <returns>The list of DTO objects.</returns>
public IEnumerable<PublishHistoryDto> FetchPublishHistory(int processId, int numberOfRecords = 10)
{
const string Query = @"
SELECT TOP (@count) Date ,
Id ,
IsSuccess ,
ProcessId ,
TimeToBuildClientLib ,
TimeToBuildServerLib ,
TimeToPublish ,
TimeToRegisterPublishedCopy ,
TimeToRetrieve ,
TimeToUpdateRuntime ,
TriggeredBy ,
TriggeredByProcess FROM dbo.PublishHistory
WHERE ProcessId = @processId
ORDER BY Date DESC
";
var result = new List<PublishHistoryDto>();
using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false))
{
var connection = ctx.Connection;
using (var cmd = new SqlCommand(Query, connection))
{
cmd.Parameters.AddWithValue("@count", numberOfRecords);
cmd.Parameters.AddWithValue("@processId", processId);
using (var reader = new SafeDataReader(cmd.ExecuteReader()))
{
{
while (reader.Read())
{
var item = new PublishHistoryDto
{
Date = reader.ReadDateTime(0),
IsSuccess = reader.GetBool(2),
ProcessId = reader.GetInt32(3),
TimeToPublish = reader.GetInt64(6)
};
result.Add(item);
}
}
}
}
}
return result;
}