当前位置: 首页>>代码示例>>C#>>正文


C# ReadOnlyDictionary.InternalSetup方法代码示例

本文整理汇总了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;
            }
        }
开发者ID:abhijitchanda,项目名称:csharp-driver,代码行数:28,代码来源:ControlConnection.cs

示例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];
            }
        }
开发者ID:abhijitchanda,项目名称:csharp-driver,代码行数:49,代码来源:ControlConnection.cs


注:本文中的ReadOnlyDictionary.InternalSetup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。