当前位置: 首页>>代码示例>>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;未经允许,请勿转载。