Пример #1
0
        public override IEnumerable <IFluentSuperColumn <CompareWith, CompareSubcolumnWith> > Execute()
        {
            CassandraSession _localSession = null;

            if (CassandraSession.Current == null)
            {
                _localSession = new CassandraSession();
            }

            try
            {
                var parent = new ColumnParent {
                    Column_family = ColumnFamily.FamilyName
                };

                if (SuperColumnName != null)
                {
                    parent.Super_column = SuperColumnName;
                }

                var output = CassandraSession.Current.GetClient().get_range_slices(
                    parent,
                    SlicePredicate.CreateSlicePredicate(),
                    KeyRange.CreateKeyRange(),
                    CassandraSession.Current.ReadConsistency
                    );

                foreach (var result in output)
                {
                    var r = new FluentSuperColumn <CompareWith, CompareSubcolumnWith>(result.Columns.Select(col => {
                        return(Helper.ConvertColumnToFluentColumn <CompareSubcolumnWith>(col.Column));
                    }));
                    ColumnFamily.Context.Attach(r);
                    r.MutationTracker.Clear();

                    yield return(r);
                }
            }
            finally
            {
                if (_localSession != null)
                {
                    _localSession.Dispose();
                }
            }
        }