本文整理汇总了C#中System.Data.SqlClient.SqlDataReader.GetSqlGuid方法的典型用法代码示例。如果您正苦于以下问题:C# SqlDataReader.GetSqlGuid方法的具体用法?C# SqlDataReader.GetSqlGuid怎么用?C# SqlDataReader.GetSqlGuid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.SqlClient.SqlDataReader
的用法示例。
在下文中一共展示了SqlDataReader.GetSqlGuid方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SqlLogEntry
/// <summary>
/// Constructs an instance of IStoreLogEntry using parts of a row from SqlDataReader.
/// Used for creating the store operation for Undo.
/// </summary>
/// <param name="reader">SqlDataReader whose row has operation information.</param>
/// <param name="offset">Reader offset for column that begins operation information.</param>
internal SqlLogEntry(SqlDataReader reader, int offset)
{
this.Id = reader.GetGuid(offset);
this.OpCode = (StoreOperationCode)reader.GetInt32(offset + 1);
this.Data = reader.GetSqlXml(offset + 2);
this.UndoStartState = (StoreOperationState)reader.GetInt32(offset + 3);
SqlGuid shardIdRemoves;
shardIdRemoves = reader.GetSqlGuid(offset + 4);
this.OriginalShardVersionRemoves = shardIdRemoves.IsNull ? default(Guid) : shardIdRemoves.Value;
SqlGuid shardIdAdds;
shardIdAdds = reader.GetSqlGuid(offset + 5);
this.OriginalShardVersionAdds = shardIdAdds.IsNull ? default(Guid) : shardIdAdds.Value;
}
示例2: DeserializeQueuedEvent
private object DeserializeQueuedEvent(SqlDataReader result)
{
var eventTypeIdColumnId = result.GetOrdinal("EventTypeId");
var eventDataColumnId = result.GetOrdinal("EventData");
result.Read();
var eventTypeId = result.GetSqlGuid(eventTypeIdColumnId).Value;
return this.serializationMethod.Deserialize(new XmlSerializedData(eventTypeId, result.GetSqlXml(eventDataColumnId).CreateReader()));
}
示例3: DeserializeEvents
private EventStream DeserializeEvents(Guid id, SqlDataReader result)
{
var lastVersion = 0;
var snapshotVersion = 0;
var eventTypeIdColumnId = result.GetOrdinal("EventTypeId");
var eventDataColumnId = result.GetOrdinal("EventData");
var versionColumnId = result.GetOrdinal("Version");
var snapshotVersionColumnId = result.GetOrdinal("SnapshotVersion");
var events = new List<object>();
while (result.Read())
{
var eventTypeId = result.GetSqlGuid(eventTypeIdColumnId).Value;
lastVersion = result.GetSqlInt32(versionColumnId).Value;
snapshotVersion = result.GetSqlInt32(snapshotVersionColumnId).Value;
events.Add(this.serializationMethod.Deserialize(new XmlSerializedData(eventTypeId, result.GetSqlXml(eventDataColumnId).CreateReader())));
}
return new EventStream(id, lastVersion, snapshotVersion, events);
}
示例4: GetGuidTest
public void GetGuidTest ()
{
cmd.CommandText = "Select type_guid,id,convert(uniqueidentifier,null)";
cmd.CommandText += "from string_family where id=1";
reader = cmd.ExecuteReader ();
reader.Read ();
// Test for standard exceptions
GetMethodTests("Guid");
// Test if data is returned correctly
Assert.AreEqual (stringRow["type_guid"], reader.GetGuid(0),
"#2 DataValidation Failed");
// Test for standard exceptions
GetMethodTests("SqlGuid");
// Test if data is returned correctly
Assert.AreEqual (stringRow["type_guid"], reader.GetSqlGuid(0).Value,
"#4 DataValidation Failed");
reader.Close ();
}