當前位置: 首頁>>代碼示例>>C#>>正文


C# CassandraContext.GetSuperColumnFamily方法代碼示例

本文整理匯總了C#中CassandraContext.GetSuperColumnFamily方法的典型用法代碼示例。如果您正苦於以下問題:C# CassandraContext.GetSuperColumnFamily方法的具體用法?C# CassandraContext.GetSuperColumnFamily怎麽用?C# CassandraContext.GetSuperColumnFamily使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CassandraContext的用法示例。


在下文中一共展示了CassandraContext.GetSuperColumnFamily方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CassandraDatabaseSetup

		public CassandraDatabaseSetup(bool reset = false, string cqlVersion = CqlVersion.Edge)
		{
			ConnectionBuilder = new ConnectionBuilder(keyspace: Keyspace, server: Server, cqlVersion: cqlVersion);
			DB = new CassandraContext(ConnectionBuilder);
			
			var exists = DB.KeyspaceExists(Keyspace);

			Family = DB.GetColumnFamily<AsciiType>("Standard");
			SuperFamily = DB.GetColumnFamily<AsciiType, AsciiType>("Super");
			UserFamily = DB.GetColumnFamily("Users");
			CounterFamily = DB.GetColumnFamily("Counters");
			SuperCounterFamily = DB.GetSuperColumnFamily("SuperCounters");

			if (exists && !reset)
				return;

			ResetDatabase();
		}
開發者ID:achinn,項目名稱:fluentcassandra,代碼行數:18,代碼來源:CassandraDatabaseSetup.cs

示例2: CreateComments

        private static void CreateComments()
        {
            using (var db = new CassandraContext(keyspace: KeyspaceName, server: Server))
            {
                var key = "first-blog-post";

                // get the comments family
                var commentsFamily = db.GetSuperColumnFamily("Comments");

                ConsoleHeader("create comments");
                var postComments = commentsFamily.CreateRecord(key: key);

                // lets attach it to the database before we add the comments
                db.Attach(postComments);

                var dt = new DateTime(2010, 11, 29, 5, 03, 00, DateTimeKind.Local);

                // add 5 comments
                for (int i = 0; i < 5; i++)
                {
                    var comment = postComments.CreateSuperColumn();
                    comment["Name"] = "Nick Berardi";
                    comment["Email"] = "[email protected]";

                    // you can also use it as a dynamic object
                    dynamic dcomment = comment;
                    dcomment.Website = "www.coderjournal.com";
                    dcomment.Comment = "Wow fluent cassandra is really great and easy to use.";

                    var commentPostedOn = dt;
                    postComments[commentPostedOn] = comment;

                    Console.WriteLine("Comment " + (i + 1) + " Posted On " + commentPostedOn.ToLongTimeString());
                    dt = dt.AddMinutes(2);
                }

                // save the comments
                db.SaveChanges();
            }
        }
開發者ID:rsparkyc,項目名稱:fluentcassandra,代碼行數:40,代碼來源:Program.cs

示例3: ReadComments

        private static void ReadComments()
        {
            using (var db = new CassandraContext(keyspace: KeyspaceName, server: Server))
            {
                var key = "first-blog-post";
                var lastDate = DateTime.Now;

                // get the comments family
                var commentsFamily = db.GetSuperColumnFamily("Comments");

                for (int page = 0; page < 2; page++)
                {
                    // lets back the date off by a millisecond so we don't get paging overlaps
                    lastDate = lastDate.AddMilliseconds(-1D);

                    ConsoleHeader("showing page " + page + " of comments starting at " + lastDate.ToLocalTime());

                    // query using API
                    var comments = commentsFamily.Get(key)
                        .ReverseColumns()
                        .StartWithColumn(lastDate)
                        .TakeColumns(3)
                        .FirstOrDefault();

                    foreach (dynamic comment in comments)
                    {
                        var dateTime = (DateTime)comment.ColumnName;

                        Console.WriteLine(String.Format("{0:T} : {1} ({2} - {3})",
                            dateTime.ToLocalTime(),
                            comment.Name,
                            comment.Email,
                            comment.Website
                        ));

                        lastDate = dateTime;
                    }
                }
            }
        }
開發者ID:nativex,項目名稱:fluentcassandra,代碼行數:40,代碼來源:Program.cs


注:本文中的CassandraContext.GetSuperColumnFamily方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。