尝试使用 C# 中的 Guid 作为 Cassandra 中的主键

Trying to use Guid from C# as primary key in Cassandra

我目前正在处理我的 NoSQL 项目,我有两个数据库 Cassandra 和 Redis(我使用 Redis 进行缓存)。现在有了 Redis,我有一个列表,我使用 DataContract 序列化我的自定义对象,但是当谈到 Cassandra 时,我很挣扎,因为我试图以某种方式在 Cassandra table 中插入 Guid,其中我使用 uuid 作为主键.我在网上搜索了一下,只能找到Guid是Cassandra的uuid类型的数据。我在 Cassandra 中使用 now() 插入了 uuid,所以我想知道我是否可以以某种方式从 C# 调用 now() 或者我是否可以以某种方式将 Guid 转换为 uuid。非常感谢任何帮助或参考。谢谢。

driver documentation, uuid is already mapped into Guid and back... So you can simply bind your variable into corresponding placeholder in statement.