本文整理汇总了C#中System.Data.SqlClient.SqlDataReader.GetGuid方法的典型用法代码示例。如果您正苦于以下问题:C# SqlDataReader.GetGuid方法的具体用法?C# SqlDataReader.GetGuid怎么用?C# SqlDataReader.GetGuid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.SqlClient.SqlDataReader
的用法示例。
在下文中一共展示了SqlDataReader.GetGuid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadFromDataReader
/// <summary>
/// Loads the entity from a <b>SqlDataReader</b> object.
/// </summary>
/// <param name="dr">The data reader to read from.</param>
/// <returns>Returns the number of columns read.</returns>
/// <remarks>
/// Always reads at the current cursor position, doesn't calls the <b>Read</b> function
/// on the <b>SqlDataReader</b> object. Reads data columns by their ordinal position in
/// the query and not by their names.
/// </remarks>
internal override int LoadFromDataReader(SqlDataReader dr)
{
int o = base.LoadFromDataReader(dr);
++o; // skip guid
this.workflowTypeName = dr.GetString(++o);
this.dateStarted = dr.IsDBNull(++o) ? DateTime.MinValue : dr.GetDateTime(o);
this.dateFinished = dr.IsDBNull(++o) ? DateTime.MinValue : dr.GetDateTime(o);
this.jobExecutionStatus = (JobExecutionState)dr.GetInt32(++o);
this.suspendTimeout = dr.IsDBNull(++o) ? DateTime.MinValue : dr.GetDateTime(o);
this.scheduleType = (ScheduleType)dr.GetInt32(++o);
this.scheduleTime = dr.IsDBNull(++o) ? DateTime.MinValue : dr.GetDateTime(o);
this.recurringPeriod = (RecurringPeriod)dr.GetInt32(++o);
this.recurringInterval = dr.GetInt32(++o);
this.recurringMask = dr.GetInt64(++o);
this.workflowInstanceId = dr.IsDBNull(++o) ? Guid.Empty : dr.GetGuid(o);
this.adminRequestTime = dr.IsDBNull(++o) ? DateTime.MinValue : dr.GetDateTime(o);
if (!dr.IsDBNull(++o))
{
XmlSerializer ser = new XmlSerializer(typeof(JobAdminRequestData));
StringReader sr = new StringReader(dr.GetString(o));
this.adminRequestData = (JobAdminRequestData)ser.Deserialize(sr);
}
else
{
this.adminRequestData = null;
}
this.adminRequestResult = dr.GetInt32(++o);
this.exceptionMessage = dr.IsDBNull(++o) ? null : dr.GetString(o);
return o;
}
示例2: Map
public override void Map(SqlDataReader sqlDataReader)
{
this.Id = sqlDataReader.GetGuid(sqlDataReader.GetOrdinal("Id"));
this.Name = sqlDataReader.GetString(sqlDataReader.GetOrdinal("Name"));
this.Level = sqlDataReader.GetByte(sqlDataReader.GetOrdinal("Level"));
this.CountryId = sqlDataReader.GetGuid(sqlDataReader.GetOrdinal("CountryId"));
}
示例3: SqlShard
/// <summary>
/// Constructs an instance of IStoreShard using parts of a row from SqlDataReader.
/// Used for creating the shard instance for a mapping.
/// </summary>
/// <param name="reader">SqlDataReader whose row has shard information.</param>
/// <param name="offset">Reader offset for column that begins shard information.</param>
internal SqlShard(SqlDataReader reader, int offset)
{
this.Id = reader.GetGuid(offset);
this.Version = reader.GetGuid(offset + 1);
this.ShardMapId = reader.GetGuid(offset + 2);
this.Location = new SqlLocation(reader, offset + 3).Location;
this.Status = reader.GetInt32(offset + 7);
}
示例4: SqlMapping
/// <summary>
/// Constructs an instance of IStoreMapping using a row from SqlDataReader.
/// </summary>
/// <param name="reader">SqlDataReader whose row has mapping information.</param>
/// <param name="offset">Reader offset for column that begins mapping information.</param>
internal SqlMapping(SqlDataReader reader, int offset)
{
this.Id = reader.GetGuid(offset);
this.ShardMapId = reader.GetGuid(offset + 1);
this.MinValue = SqlUtils.ReadSqlBytes(reader, offset + 2);
this.MaxValue = SqlUtils.ReadSqlBytes(reader, offset + 3);
this.Status = reader.GetInt32(offset + 4);
this.LockOwnerId = reader.GetGuid(offset + 5);
this.StoreShard = new SqlShard(reader, offset + 6);
}
示例5: Load
internal static Message Load(SqlDataReader reader) {
var message = new Message
{
ConversationGroupId = reader.GetGuid(0),
ConversationHandle = reader.GetGuid(1),
MessageSequenceNumber = reader.GetInt64(2),
ServiceName = reader.GetString(3),
ServiceContractName = reader.GetString(4),
MessageTypeName = reader.GetString(5),
Body = reader.IsDBNull(7) ? new byte[0] : reader.GetSqlBytes(7).Buffer
};
return message;
}
示例6: GetError
public static Exception GetError(XName commandName, CommandResult result, SqlDataReader reader)
{
Exception returnValue = null;
if (result != CommandResult.Success)
{
switch (result)
{
case CommandResult.InstanceAlreadyExists:
returnValue = new InstanceCollisionException(commandName, reader.GetGuid(1));
break;
case CommandResult.InstanceLockNotAcquired:
returnValue = new InstanceLockedException(commandName, reader.GetGuid(1), reader.GetGuid(2), ReadLockOwnerMetadata(reader));
break;
case CommandResult.InstanceNotFound:
returnValue = new InstanceNotReadyException(commandName, reader.GetGuid(1));
break;
case CommandResult.KeyAlreadyExists:
returnValue = new InstanceKeyCollisionException(commandName, Guid.Empty,
new InstanceKey(reader.GetGuid(1)), Guid.Empty);
break;
case CommandResult.KeyNotFound:
returnValue = new InstanceKeyNotReadyException(commandName, new InstanceKey(reader.GetGuid(1)));
break;
case CommandResult.InstanceLockLost:
returnValue = new InstanceLockLostException(commandName, reader.GetGuid(1));
break;
case CommandResult.InstanceCompleted:
returnValue = new InstanceCompleteException(commandName, reader.GetGuid(1));
break;
case CommandResult.KeyDisassociated:
returnValue = new InstanceKeyCompleteException(commandName, new InstanceKey(reader.GetGuid(1)));
break;
case CommandResult.StaleInstanceVersion:
returnValue = new InstanceLockLostException(commandName, reader.GetGuid(1));
break;
case CommandResult.HostLockExpired:
returnValue = new InstancePersistenceException(SR.HostLockExpired);
break;
case CommandResult.HostLockNotFound:
returnValue = new InstancePersistenceException(SR.HostLockNotFound);
break;
case CommandResult.CleanupInProgress:
returnValue = new InstancePersistenceCommandException(SR.CleanupInProgress);
break;
case CommandResult.InstanceAlreadyLockedToOwner:
returnValue = new InstanceAlreadyLockedToOwnerException(commandName, reader.GetGuid(1), reader.GetInt64(2));
break;
default:
returnValue = new InstancePersistenceCommandException(SR.UnknownSprocResult(result));
break;
}
}
return returnValue;
}
示例7: SqlShardMap
/// <summary>
/// Constructs an instance of IStoreShardMap using a row from SqlDataReader starting at specified offset.
/// </summary>
/// <param name="reader">SqlDataReader whose row has shard map information.</param>
/// <param name="offset">Reader offset for column that begins shard map information..</param>
internal SqlShardMap(SqlDataReader reader, int offset)
{
this.Id = reader.GetGuid(offset);
this.Name = reader.GetString(offset + 1);
this.MapType = (ShardMapType)reader.GetInt32(offset + 2);
this.KeyType = (ShardKeyType)reader.GetInt32(offset + 3);
}
示例8: Load
internal static Message Load(SqlDataReader reader) {
var message = new Message();
// RECEIVE conversation_group_id, conversation_handle,
// message_sequence_number, service_name, service_contract_name,
// message_type_name, validation, message_body
// FROM Queue
message.ConversationGroupId = reader.GetGuid(0);
message.ConversationHandle = reader.GetGuid(1);
message.MessageSequenceNumber = reader.GetInt64(2);
message.ServiceName = reader.GetString(3);
message.ServiceContractName = reader.GetString(4);
message.MessageTypeName = reader.GetString(5);
//m_validation = reader.GetString(6);
if (!reader.IsDBNull(7)) {
message.Body = reader.GetSqlBytes(7).Buffer;
} else
message.Body = new byte[0];
return message;
}
示例9: ReadDataRow
private EventDataRow ReadDataRow(SqlDataReader eventReader)
{
return new EventDataRow
{
EventJson = eventReader.GetString(1),
EventType = eventReader.GetInt32(0),
AggregateRootId = eventReader.GetGuid(2),
AggregateRootVersion = eventReader[3] as int? ?? eventReader.GetInt32(10),
EventId = eventReader.GetGuid(4),
UtcTimeStamp = DateTime.SpecifyKind(eventReader.GetDateTime(5), DateTimeKind.Utc),
//Without this the datetime will be DateTimeKind.Unspecified and will not convert correctly into Local time....
InsertionOrder = eventReader.GetInt64(6),
InsertAfter = eventReader[7] as long?,
InsertBefore = eventReader[8] as long?,
Replaces = eventReader[9] as long?,
InsertedVersion = eventReader.GetInt32(10),
ManualVersion = eventReader[11] as int?,
EffectiveVersion = eventReader[3] as int?
};
}
示例10: 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;
}
示例11: CreateNotification
private Notification CreateNotification(SqlDataReader reader)
{
return new Notification
{
ID = reader.GetGuid(reader.GetOrdinal("NotificationID")),
LanguageCode = GetString(reader, "LanguageCode"),
Subject = GetString(reader, "Subject"),
TypeKey = GetString(reader, "TypeKey"),
Dispatched = reader.GetBoolean(reader.GetOrdinal("Dispatched")),
Parameter = new JavaScriptSerializer().Deserialize<Dictionary<string, string>>(
GetString(reader, "Parameter")
)
};
}
示例12: ServiceBrokerMessage
private ServiceBrokerMessage(SqlDataReader reader)
{
ConversationHandle = reader.GetGuid(0);
ServiceName = reader.GetString(1);
ServiceContractName = reader.GetString(2);
MessageTypeName = reader.GetString(3);
if (!reader.IsDBNull(4))
{
Body = reader.GetSqlBytes(4).Buffer;
}
else
{
Body = new byte[0];
}
}
示例13: Load
public static ServiceBrokerMessage Load(SqlDataReader reader)
{
var message = new ServiceBrokerMessage();
message.ConversationHandle = reader.GetGuid(0);
message.ServiceName = reader.GetString(1);
message.ServiceContractName = reader.GetString(2);
message.MessageTypeName = reader.GetString(3);
if (!reader.IsDBNull(4))
{
message.Body = reader.GetSqlBytes(4).Buffer;
}
else
{
message.Body = new byte[0];
}
return message;
}
示例14: Map
public override void Map(SqlDataReader sqlDataReader)
{
this.Id = sqlDataReader.GetGuid(sqlDataReader.GetOrdinal("Id"));
this.Name = sqlDataReader.GetString(sqlDataReader.GetOrdinal("Name"));
this.StartYear = sqlDataReader.GetInt32(sqlDataReader.GetOrdinal("StartYear"));
}
示例15: BuildInstance
internal static SqlTrackingWorkflowInstance BuildInstance(SqlDataReader reader, string connectionString)
{
if (reader == null)
{
throw new ArgumentNullException("reader");
}
if (reader.IsClosed)
{
throw new ArgumentException(ExecutionStringManager.InvalidSqlDataReader, "reader");
}
SqlTrackingWorkflowInstance instance = new SqlTrackingWorkflowInstance(connectionString) {
WorkflowInstanceId = reader.GetGuid(1),
WorkflowInstanceInternalId = reader.GetInt64(2),
Initialized = reader.GetDateTime(3)
};
if (DBNull.Value == reader[4])
{
instance.InvokingWorkflowInstanceId = Guid.Empty;
}
else
{
instance.InvokingWorkflowInstanceId = reader.GetGuid(4);
}
instance.Status = (WorkflowStatus) reader.GetInt32(5);
if (!reader.IsDBNull(6))
{
instance.WorkflowType = Type.GetType(reader.GetString(6) + ", " + reader.GetString(7), true, false);
}
return instance;
}