I have a .net core application which persists data to a Cassandra instance through DataStax driver.
I have a base class for my Cassandra entities. Now if I want to take my TimeUUID type id into this base class, when inserting I get the error:
Some partition key parts are missing: id
Same approach works in EntityFramework. And also problem is not with my tables, connection or keyspace since when I carry the id field back to entty itself, it works.
My insert method
public void Insert<T>(T entity) where T : EntityBase
{
_mapper.Insert(entity);
}
My base class
public class EntityBase
{
[Column(name: "id")]
public TimeUuid Id { get; private set; } = TimeUuid.NewId();
}
An entity class which inherits base class
[Table(Keyspace = "unimportant", Name = "irrelevant")]
public class Irrelevant : EntityBase
{
//fields
}
Can you tell me what is problem ? Is there a way to declare a CassandraEntityBaseClass ?