NoSQL first experience in C # .NET using Cassandra

Abstract: NoSQL in the early experience using C # .NET Cassandra


About http://cassandra.apache.org/

The following will be recorded my first contact practice of NoSQL Cassandra ,, and through Cassandraemon.dll operating in C # project.

Step1 Installation

After so long unzipped directory

Step2 modify variables

Step3 execution F: CDbincassandra.bat start

Step4 execution F: CDbincassandra-cli began to create keysapce

Step5 Create a column family (like a table)

Step6 practice C # insert data and fishing data

using Apache.Cassandra;
using Cassandraemon;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace consoleGoogleResearch
{
    class Program
    {
        public static void Main(string[] args)
        {

            using (var context = new CassandraContext("localhost", 9160, "Demospace"))
            {
                var key = "1".ToCassandraByte();
                const string columnName = "last";
                const string value = "raymond";
                var column = new Column().SetNameValue(columnName, value);
                context.InsertOnSubmit("User", key, column);

                context.SubmitChanges();
             
                var entitys = from x in context.Column
                              where
                                x.ColumnFamily == "User" &&
                                x.Column == "last"
                              select x;

                foreach (CassandraEntity e in entitys)
                {
                    Console.WriteLine(e.Data.Name.ToInt32());
                    Console.WriteLine(e.Data.Value.ToUTF8());
                }
                Console.ReadKey();
               
            }
        
        }


    }

result

These are my first experience of sharing NoSQL first subsequent application of - I will continue to follow up please advise

There are many more detailed description of the installation have no time to fix the

Original: Large column  NoSQL first experience in C # .NET using Cassandra


Guess you like

Origin www.cnblogs.com/chinatrump/p/11512953.html