【发布时间】:2019-12-22 11:44:52
【问题描述】:
我有一个如下所示的 C# 类
public class User
{
public string UserId { get; set; }
public string Name { get; set; }
public List<Address> Address { get; set; }
}
public class Address
{
public string Line1 { get; set; }
}
我创建了如下的键空间和表
ISession session;
IMapper Mapper;
Table<User> table;
var mapping = MappingConfiguration.Global.Define(
new Map<User>()
.TableName(typeof(User).Name)
.PartitionKey(u => u.UserId))
;
Dictionary<string, string> replication = new Dictionary<string, string>();
replication.Add("class", "SimpleStrategy");
replication.Add("replication_factor", "3");
var cluster = Cluster.Builder()
.AddContactPoints("127.0.1")
.WithPort(9042)
.WithLoadBalancingPolicy(new DCAwareRoundRobinPolicy("test"))
.WithReconnectionPolicy(new FixedReconnectionPolicy(400, 5000, 2 * 60000, 60 * 60000))
.Build();
session = cluster.Connect();
session.CreateKeyspaceIfNotExists("demo1", replication);
session = cluster.Connect("demo1");
table = new Table<User>(session, mapping, typeof(User).Name, "demo1");
table.CreateIfNotExists();
我收到以下错误
Cassandra.InvalidTypeException: 'CLR 的未知 Cassandra 目标类型 键入 Casandra.Address'
【问题讨论】: