本文整理汇总了C#中IDataReader.GetGuid方法的典型用法代码示例。如果您正苦于以下问题:C# IDataReader.GetGuid方法的具体用法?C# IDataReader.GetGuid怎么用?C# IDataReader.GetGuid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDataReader
的用法示例。
在下文中一共展示了IDataReader.GetGuid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetValueByName
/// <summary>
/// Gets a column value by the name
/// </summary>
/// <param name="mapping"></param>
/// <param name="dataReader"></param>
/// <returns></returns>
public override object GetValueByName(ResultProperty mapping, IDataReader dataReader)
{
int index = dataReader.GetOrdinal(mapping.ColumnName);
if (dataReader.IsDBNull(index))
{
return DBNull.Value;
}
return new Guid?( dataReader.GetGuid(index) );
}
示例2: Get
/// <summary>
///
/// </summary>
/// <param name="rs"></param>
/// <param name="index"></param>
/// <returns></returns>
public override object Get(IDataReader rs, int index)
{
if (rs.GetFieldType(index) == typeof(Guid))
{
return rs.GetGuid(index);
}
else
{
return new Guid(Convert.ToString(rs[index]));
}
}
示例3: Log
/// <summary>
/// Initializes a new instance of the <see cref="Log"/> class.
/// </summary>
/// <param name="reader">The reader.</param>
internal Log(IDataReader reader)
{
int logGroupColumn = reader.GetOrdinal("LogGroup");
int logLevelColumn = reader.GetOrdinal("LogLevel");
int messageColumn = reader.GetOrdinal("Message");
int stackTraceColumn = reader.GetOrdinal("StackTrace");
int logDateTimeColumn = reader.GetOrdinal("LogDateTime");
LogGroup = reader.GetGuid(logGroupColumn);
LogLevel = (LogLevel)reader.GetInt32(logLevelColumn);
Message = reader.GetString(messageColumn);
StackTrace = reader.GetString(stackTraceColumn);
LogDateTime = reader.GetDateTime(logDateTimeColumn);
}
示例4: GetValue
public override object GetValue(IDataReader reader, int columnIndex, object[] values)
{
if (values != null)
{
if (values[columnIndex] == DBNull.Value)
return null;
}
else
{
if (reader.IsDBNull(columnIndex))
return null;
}
return reader.GetGuid(columnIndex);
}
示例5: GetUserFromDataReader
private MembershipUser GetUserFromDataReader(IDataReader dataReader)
{
MembershipUser membershipUser = null;
try
{
Guid providerUserKey = dataReader.GetGuid(1);
string username = dataReader.GetString(3);
string email = dataReader.GetString(5);
string passwordQuestion = dataReader.GetValue(6) is DBNull ? null : dataReader.GetString(6);
string comment = dataReader.GetValue(8) is DBNull ? null : dataReader.GetString(8);
DateTime lastActivityDate = dataReader.GetDateTime(9);
DateTime lastLoginDate = dataReader.GetDateTime(10);
DateTime lastPasswordChangedDate = dataReader.GetDateTime(11);
bool isApproved = dataReader.GetBoolean(16);
bool isLockedOut = dataReader.GetBoolean(17);
DateTime lastLockedOutDate = dataReader.GetDateTime(18);
DateTime creationDate = dataReader.GetDateTime(19);
membershipUser = new MembershipUser(Name, username, providerUserKey, email, passwordQuestion, comment,
isApproved, isLockedOut, creationDate, lastLoginDate,
lastActivityDate, lastPasswordChangedDate, lastLockedOutDate);
}
catch (Exception)
{
}
return membershipUser;
}
示例6: GetResult
public FileOrganizationResult GetResult(IDataReader reader)
{
var index = 0;
var result = new FileOrganizationResult
{
Id = reader.GetGuid(0).ToString("N")
};
index++;
if (!reader.IsDBNull(index))
{
result.OriginalPath = reader.GetString(index);
}
index++;
if (!reader.IsDBNull(index))
{
result.TargetPath = reader.GetString(index);
}
index++;
result.FileSize = reader.GetInt64(index);
index++;
result.Date = reader.GetDateTime(index).ToUniversalTime();
index++;
result.Status = (FileSortingStatus)Enum.Parse(typeof(FileSortingStatus), reader.GetString(index), true);
index++;
result.Type = (FileOrganizerType)Enum.Parse(typeof(FileOrganizerType), reader.GetString(index), true);
index++;
if (!reader.IsDBNull(index))
{
result.StatusMessage = reader.GetString(index);
}
result.OriginalFileName = Path.GetFileName(result.OriginalPath);
index++;
if (!reader.IsDBNull(index))
{
result.ExtractedName = reader.GetString(index);
}
index++;
if (!reader.IsDBNull(index))
{
result.ExtractedYear = reader.GetInt32(index);
}
index++;
if (!reader.IsDBNull(index))
{
result.ExtractedSeasonNumber = reader.GetInt32(index);
}
index++;
if (!reader.IsDBNull(index))
{
result.ExtractedEpisodeNumber = reader.GetInt32(index);
}
index++;
if (!reader.IsDBNull(index))
{
result.ExtractedEndingEpisodeNumber = reader.GetInt32(index);
}
index++;
if (!reader.IsDBNull(index))
{
result.DuplicatePaths = reader.GetString(index).Split('|').Where(i => !string.IsNullOrEmpty(i)).ToList();
}
return result;
}
示例7: PopulateMail
private static Message PopulateMail(IDataReader dataReader)
{
Message mail = new Message();
mail.UID = dataReader.GetGuid(0);
if (dataReader.IsDBNull(1))
mail.System = null;
else
mail.System = dataReader.GetGuid(1);
mail.From = dataReader.GetString(2);
mail.To = dataReader.GetString(3);
mail.CC = dataReader.IsDBNull(4) ? null : dataReader.GetString(4);
mail.BCC = dataReader.IsDBNull(5) ? null : dataReader.GetString(5);
mail.ReplyTo = dataReader.IsDBNull(6) ? null : dataReader.GetString(6);
mail.Sender = dataReader.IsDBNull(7) ? null : dataReader.GetString(7);
mail.Priority = (MailPriority)dataReader.GetInt32(8);
mail.Subject = dataReader.GetString(9);
mail.Body = dataReader.IsDBNull(10) ? null : dataReader.GetString(10);
mail.CreateTime = dataReader.GetDateTime(11);
mail.Status = dataReader.GetInt32(12);
return mail;
}
示例8: GetEntry
private ActivityLogEntry GetEntry(IDataReader reader)
{
var index = 0;
var info = new ActivityLogEntry
{
Id = reader.GetGuid(index).ToString("N")
};
index++;
if (!reader.IsDBNull(index))
{
info.Name = reader.GetString(index);
}
index++;
if (!reader.IsDBNull(index))
{
info.Overview = reader.GetString(index);
}
index++;
if (!reader.IsDBNull(index))
{
info.ShortOverview = reader.GetString(index);
}
index++;
if (!reader.IsDBNull(index))
{
info.Type = reader.GetString(index);
}
index++;
if (!reader.IsDBNull(index))
{
info.ItemId = reader.GetString(index);
}
index++;
if (!reader.IsDBNull(index))
{
info.UserId = reader.GetString(index);
}
index++;
info.Date = reader.GetDateTime(index).ToUniversalTime();
index++;
if (!reader.IsDBNull(index))
{
info.Severity = (LogSeverity)Enum.Parse(typeof(LogSeverity), reader.GetString(index), true);
}
return info;
}
示例9: GetGuidValue
public static string GetGuidValue(
IDataReader rs,
string fieldName)
{
int col = rs.GetOrdinal(fieldName);
return rs.IsDBNull(col) ? null : rs.GetGuid(col).ToString();
}
示例10: Get
private AuthenticationInfo Get(IDataReader reader)
{
var info = new AuthenticationInfo
{
Id = reader.GetGuid(0).ToString("N"),
AccessToken = reader.GetString(1)
};
if (!reader.IsDBNull(2))
{
info.DeviceId = reader.GetString(2);
}
if (!reader.IsDBNull(3))
{
info.AppName = reader.GetString(3);
}
if (!reader.IsDBNull(4))
{
info.AppVersion = reader.GetString(4);
}
if (!reader.IsDBNull(5))
{
info.DeviceName = reader.GetString(5);
}
if (!reader.IsDBNull(6))
{
info.UserId = reader.GetString(6);
}
info.IsActive = reader.GetBoolean(7);
info.DateCreated = reader.GetDateTime(8).ToUniversalTime();
if (!reader.IsDBNull(9))
{
info.DateRevoked = reader.GetDateTime(9).ToUniversalTime();
}
return info;
}
示例11: GetGuid
public Guid GetGuid(IDataReader reader, bool allowNulls, Guid missingColumnValue)
{
InitColumn(reader, true);
if (Ordinal == ColumnNotFound)
{
return missingColumnValue;
}
if (allowNulls && reader.IsDBNull(Ordinal))
{
return Guid.Empty;
}
else
{
return reader.GetGuid(Ordinal);
}
}
示例12: GetJobItem
private SyncJobItem GetJobItem(IDataReader reader)
{
var info = new SyncJobItem
{
Id = reader.GetGuid(0).ToString("N"),
ItemId = reader.GetString(1)
};
if (!reader.IsDBNull(2))
{
info.ItemName = reader.GetString(2);
}
if (!reader.IsDBNull(3))
{
info.MediaSourceId = reader.GetString(3);
}
info.JobId = reader.GetString(4);
if (!reader.IsDBNull(5))
{
info.OutputPath = reader.GetString(5);
}
if (!reader.IsDBNull(6))
{
info.Status = (SyncJobItemStatus)Enum.Parse(typeof(SyncJobItemStatus), reader.GetString(6), true);
}
info.TargetId = reader.GetString(7);
info.DateCreated = reader.GetDateTime(8);
if (!reader.IsDBNull(9))
{
info.Progress = reader.GetDouble(9);
}
return info;
}
示例13: GetJob
private SyncJob GetJob(IDataReader reader)
{
var info = new SyncJob
{
Id = reader.GetGuid(0).ToString("N"),
TargetId = reader.GetString(1),
Name = reader.GetString(2)
};
if (!reader.IsDBNull(3))
{
info.Quality = (SyncQuality)Enum.Parse(typeof(SyncQuality), reader.GetString(3), true);
}
if (!reader.IsDBNull(4))
{
info.Status = (SyncJobStatus)Enum.Parse(typeof(SyncJobStatus), reader.GetString(4), true);
}
if (!reader.IsDBNull(5))
{
info.Progress = reader.GetDouble(5);
}
if (!reader.IsDBNull(6))
{
info.UserId = reader.GetString(6);
}
if (!reader.IsDBNull(7))
{
info.RequestedItemIds = reader.GetString(7).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
}
if (!reader.IsDBNull(8))
{
info.Category = (SyncCategory)Enum.Parse(typeof(SyncCategory), reader.GetString(8), true);
}
if (!reader.IsDBNull(9))
{
info.ParentId = reader.GetString(9);
}
if (!reader.IsDBNull(10))
{
info.UnwatchedOnly = reader.GetBoolean(10);
}
if (!reader.IsDBNull(11))
{
info.ItemLimit = reader.GetInt32(11);
}
info.SyncNewContent = reader.GetBoolean(12);
info.DateCreated = reader.GetDateTime(13).ToUniversalTime();
info.DateLastModified = reader.GetDateTime(14).ToUniversalTime();
info.ItemCount = reader.GetInt32(15);
return info;
}
示例14: GetValueByIndex
/// <summary>
/// Gets a column value by the index
/// </summary>
/// <param name="mapping"></param>
/// <param name="dataReader"></param>
/// <returns></returns>
public override object GetValueByIndex(ResultProperty mapping, IDataReader dataReader)
{
if (dataReader.IsDBNull(mapping.ColumnIndex))
{
return DBNull.Value;
}
return new Guid?( dataReader.GetGuid(mapping.ColumnIndex) );
}
示例15: ReadGuid
/// <summary> Capture the column value for the current row </summary>
/// <param name="reader"></param>
/// <param name="columnIndex"></param>
/// <returns></returns>
public static Guid? ReadGuid(IDataReader reader, int columnIndex)
{
return reader.IsDBNull(columnIndex) ? null : (Guid?)reader.GetGuid(columnIndex);
}