本文整理汇总了C#中Row.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Row.GetValue方法的具体用法?C# Row.GetValue怎么用?C# Row.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Row
的用法示例。
在下文中一共展示了Row.GetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MapRowToVideoPreview
/// <summary>
/// Maps a row to a VideoPreview object.
/// </summary>
private static VideoPreview MapRowToVideoPreview(Row row)
{
return new VideoPreview
{
VideoId = row.GetValue<Guid>("videoid"),
AddedDate = row.GetValue<DateTimeOffset>("added_date"),
Name = row.GetValue<string>("name"),
PreviewImageLocation = row.GetValue<string>("preview_image_location"),
UserId = row.GetValue<Guid>("userid")
};
}
示例2: MapRowToPlayStats
private static PlayStats MapRowToPlayStats(Row row, Guid videoId)
{
// For null rows, just return an empty stats object with 0 views (since we won't have rows for a video until it has at least one view)
if (row == null)
return new PlayStats { VideoId = videoId, Views = 0 };
return new PlayStats
{
VideoId = row.GetValue<Guid>("videoid"),
Views = row.GetValue<long>("views")
};
}
示例3: Build
/// <summary>
/// Creates a new instance of function metadata based on a schema_function row.
/// </summary>
internal static AggregateMetadata Build(int protocolVersion, Row row)
{
var emptyArray = new string[0];
var aggregate = new AggregateMetadata
{
Name = row.GetValue<string>("aggregate_name"),
KeyspaceName = row.GetValue<string>("keyspace_name"),
Signature = row.GetValue<string[]>("signature") ?? emptyArray,
StateFunction = row.GetValue<string>("state_func"),
StateType = TypeCodec.ParseDataType(row.GetValue<string>("state_type")),
FinalFunction = row.GetValue<string>("final_func"),
ReturnType = TypeCodec.ParseDataType(row.GetValue<string>("return_type")),
ArgumentTypes = (row.GetValue<string[]>("argument_types") ?? emptyArray).Select(s => TypeCodec.ParseDataType(s)).ToArray(),
};
aggregate.InitialCondition = TypeCodec.Decode(protocolVersion, row.GetValue<byte[]>("initcond"), aggregate.StateType.TypeCode, aggregate.StateType.TypeInfo);
return aggregate;
}
示例4: UpdateLocalInfo
internal void UpdateLocalInfo(Row row)
{
var localhost = _host;
// Update cluster name, DC and rack for the one node we are connected to
var clusterName = row.GetValue<string>("cluster_name");
if (clusterName != null)
{
Metadata.ClusterName = clusterName;
}
localhost.SetLocationInfo(row.GetValue<string>("data_center"), row.GetValue<string>("rack"));
localhost.Tokens = row.GetValue<IEnumerable<string>>("tokens") ?? new string[0];
}
示例5: Build
/// <summary>
/// Creates a new instance of function metadata based on a schema_function row.
/// </summary>
internal static FunctionMetadata Build(Row row)
{
var emptyArray = new string[0];
return new FunctionMetadata
{
Name = row.GetValue<string>("function_name"),
KeyspaceName = row.GetValue<string>("keyspace_name"),
Signature = row.GetValue<string[]>("signature") ?? emptyArray,
ArgumentNames = row.GetValue<string[]>("argument_names") ?? emptyArray,
Body = row.GetValue<string>("body"),
CalledOnNullInput = row.GetValue<bool>("called_on_null_input"),
Language = row.GetValue<string>("language"),
ReturnType = TypeCodec.ParseDataType(row.GetValue<string>("return_type")),
ArgumentTypes = (row.GetValue<string[]>("argument_types") ?? emptyArray).Select(s => TypeCodec.ParseDataType(s)).ToArray()
};
}
示例6: SetCassandraVersion
internal static void SetCassandraVersion(Host host, Row row)
{
try
{
var releaseVersion = row.GetValue<string>("release_version");
if (releaseVersion != null)
{
host.CassandraVersion = Version.Parse(releaseVersion.Split('-')[0]);
}
}
catch (Exception ex)
{
_logger.Error("There was an error while trying to retrieve the Cassandra version", ex);
}
}
示例7: MapRowToUserProfile
private static UserProfile MapRowToUserProfile(Row row)
{
if (row == null) return null;
return new UserProfile
{
UserId = row.GetValue<Guid>("userid"),
FirstName = row.GetValue<string>("firstname"),
LastName = row.GetValue<string>("lastname"),
EmailAddress = row.GetValue<string>("email")
};
}
示例8: FormTrigger
private TriggerInfo FormTrigger(Row row)
{
var schema = row.GetValue(0).Value.ToString();
var name = row.GetValue(1).Value.ToString();
var triggerName = new ObjectName(new ObjectName(schema), name);
var triggerType = (TriggerType)((SqlNumber)row.GetValue(2).Value).ToInt32();
// TODO: In case it's a procedural trigger, take the reference to the procedure
if (triggerType == TriggerType.Procedure)
throw new NotImplementedException();
var tableName = ObjectName.Parse(((SqlString) row.GetValue(3).Value).ToString());
var eventType = (TriggerEventType) ((SqlNumber) row.GetValue(4).Value).ToInt32();
return new TriggerInfo(triggerName, triggerType, eventType, tableName);
}
示例9: ParseKeyspaceRow
private KeyspaceMetadata ParseKeyspaceRow(Row row)
{
return new KeyspaceMetadata(
ControlConnection,
row.GetValue<string>("keyspace_name"),
row.GetValue<bool>("durable_writes"),
row.GetValue<string>("strategy_class"),
Utils.ConvertStringToMapInt(row.GetValue<string>("strategy_options")));
}
示例10: MapRowToSkeletonItem
private static InventorySkeletonEntry MapRowToSkeletonItem(Row row)
{
return new InventorySkeletonEntry
{
UserId = row.GetValue<Guid>("user_id"),
FolderId = row.GetValue<Guid>("folder_id"),
Name = row.GetValue<string>("folder_name"),
ParentId = row.GetValue<Guid>("parent_id"),
Type = (byte)row.GetValue<int>("type"),
Level = (FolderLevel)row.GetValue<int>("level")
};
}
示例11: MapRowToItem
private static InventoryItem MapRowToItem(Row row)
{
return new InventoryItem
{
AssetId = row.GetValue<Guid>("asset_id"),
AssetType = row.GetValue<int>("asset_type"),
BasePermissions = row.GetValue<int>("base_permissions"),
CreationDate = row.GetValue<int>("creation_date"),
CreatorId = row.GetValue<Guid>("creator_id"),
CurrentPermissions = row.GetValue<int>("current_permissions"),
Description = row.GetValue<string>("description"),
EveryonePermissions = row.GetValue<int>("everyone_permissions"),
Flags = row.GetValue<int>("flags"),
FolderId = row.GetValue<Guid>("folder_id"),
GroupId = row.GetValue<Guid>("group_id"),
GroupOwned = row.GetValue<bool>("group_owned"),
GroupPermissions = row.GetValue<int>("group_permissions"),
InventoryType = row.GetValue<int>("inv_type"),
ItemId = row.GetValue<Guid>("item_id"),
Name = row.GetValue<string>("name"),
NextPermissions = row.GetValue<int>("next_permissions"),
OwnerId = row.GetValue<Guid>("owner_id"),
SaleType = row.GetValue<int>("sale_type")
};
}
示例12: MapRowToFolder
private static void MapRowToFolder(InventoryFolder retFolder, Row row)
{
retFolder.CreationDate = row.GetValue<int>("creation_date");
retFolder.Name = row.GetValue<string>("name");
retFolder.OwnerId = row.GetValue<Guid>("owner_id");
retFolder.Type = row.GetValue<int>("inv_type");
}
示例13: SetValue
internal void SetValue(Row row, object obj)
{
var colIndex = row.Table.TableInfo.IndexOfColumn(ColumnName);
if (colIndex < 0)
throw new InvalidOperationException(String.Format("The source table '{0}' has no column named '{1}'.",
row.Table.TableInfo.TableName, ColumnName));
var value = row.GetValue(colIndex);
if (Field.IsNullField(value)) {
if (!IsNullable)
throw new InvalidOperationException(String.Format("Cannot set NULL to the non-nullable field '{0}' of {1}.",
Member.Name, Member.DeclaringType));
}
var memberValue = value.ConvertTo(MemberType);
if (Member is PropertyInfo) {
((PropertyInfo)Member).SetValue(obj, memberValue, null);
} else if (Member is FieldInfo) {
((FieldInfo)Member).SetValue(obj, memberValue);
}
}
示例14: UpdateRow
public void UpdateRow(Row row)
{
if (row.RowId.RowNumber < 0 ||
row.RowId.RowNumber >= 1)
throw new ArgumentOutOfRangeException();
if (readOnly)
throw new NotSupportedException(String.Format("Updating '{0}' is not permitted.", tableInfo.TableName));
int sz = TableInfo.ColumnCount;
for (int i = 0; i < sz; ++i) {
data.SetValue(i, row.GetValue(i));
}
}
示例15: GetAddressForPeerHost
/// <summary>
/// Uses system.peers values to build the Address translator
/// </summary>
internal static IPEndPoint GetAddressForPeerHost(Row row, IAddressTranslator translator, int port)
{
var address = row.GetValue<IPAddress>("rpc_address");
if (address == null)
{
return null;
}
if (BindAllAddress.Equals(address) && !row.IsNull("peer"))
{
address = row.GetValue<IPAddress>("peer");
_logger.Warning(String.Format("Found host with 0.0.0.0 as rpc_address, using listen_address ({0}) to contact it instead. If this is incorrect you should avoid the use of 0.0.0.0 server side.", address));
}
return translator.Translate(new IPEndPoint(address, port));
}