本文整理汇总了C#中ReadOnlyDictionary.InternalSetup方法的典型用法代码示例。如果您正苦于以下问题:C# ReadOnlyDictionary.InternalSetup方法的具体用法?C# ReadOnlyDictionary.InternalSetup怎么用?C# ReadOnlyDictionary.InternalSetup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReadOnlyDictionary
的用法示例。
在下文中一共展示了ReadOnlyDictionary.InternalSetup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetupSchema
private ReadOnlyDictionary<string, KeyspaceMetadata> SetupSchema()
{
var ks = _keyspaces.Value;
if (ks == null)
{
var newKeyspaces = new ReadOnlyDictionary<string, KeyspaceMetadata>();
using (var rows = _session.Query(SelectKeyspaces))
{
foreach (var row in rows.GetRows())
{
var strKsName = row.GetValue<string>("keyspace_name");
var strClass = GetStrategyClass(row.GetValue<string>("strategy_class"));
var drblWrites = row.GetValue<bool>("durable_writes");
var rplctOptions = Utils.ConvertStringToMapInt(row.GetValue<string>("strategy_options"));
var newMetadata = new KeyspaceMetadata(this, strKsName, drblWrites, strClass,
new ReadOnlyDictionary<string, int>(rplctOptions));
newKeyspaces.InternalSetup(strKsName, newMetadata);
}
}
return _keyspaces.Value = newKeyspaces;
}
else
{
return ks;
}
}
示例2: SetupKeyspace
private KeyspaceMetadata SetupKeyspace(string keyspace)
{
var sc = SetupSchema();
if (!sc.ContainsKey(keyspace) || sc[keyspace].Tables.Value == null)
{
WaitForSchemaAgreement();
ResetSchema();
sc= SetupSchema();
KeyspaceMetadata ks = null;
using (
var rows =
_session.Query(
string.Format(
SelectKeyspaces + " WHERE keyspace_name='{0}';",
keyspace)))
{
foreach (var row in rows.GetRows())
{
var strKsName = row.GetValue<string>("keyspace_name");
var strClass = GetStrategyClass(row.GetValue<string>("strategy_class"));
var drblWrites = row.GetValue<bool>("durable_writes");
var rplctOptions = Utils.ConvertStringToMapInt(row.GetValue<string>("strategy_options"));
ks = new KeyspaceMetadata(this, strKsName, drblWrites, strClass,
new ReadOnlyDictionary<string, int>(rplctOptions));
}
}
if(ks==null)
throw new InvalidOperationException();
var ktb = new ReadOnlyDictionary<string, AtomicValue<TableMetadata>>();
using (
var rows =
_session.Query(string.Format(SelectColumnFamilies + " WHERE keyspace_name='{0}';", keyspace)))
{
foreach (var row in rows.GetRows())
ktb.InternalSetup(row.GetValue<string>("columnfamily_name"), new AtomicValue<TableMetadata>(null));
}
ks.Tables.Value = ktb;
sc.InternalSetup(ks.Name, ks);
return ks;
}
else
{
return sc[keyspace];
}
}