cassandra - ClusterKey Attribute in DataStax C# Driver -
i have been trying test object mapping working using attributes in datastax c# driver cassandra. there table in cassandra defined by
create table test.omfieldtest ( integer int, bigint varint, stringtext text, universal uuid, bool boolean, singleprecision float, variableprecision decimal, primary key ((integer), bigint, stringtext, universal) );
i have decorated c# class map table
[table("test.omfieldtest")] public class mappingtest { [partitionkey] public int32 integer; [clusteringkey(0, sortorder.ascending, name = "bigint")] public int64 bigint; [clusteringkey(1, sortorder.ascending, name = "stringtext")] public string stringval; [clusteringkey(2, sortorder.ascending, name = "universal")] public guid universal; [column("bool")] public bool boolval; [column("singleprecision")] public single singleprecisionval; [column("variableprecision")] public decimal variableprecisionval; }
upon using mapper.insert<mappingtest>
, invalidqueryexception thrown problem of "unknown identifier stringval".if change name of property match column name, works fine, regardless of name property of clusterkey
set to.
so purpose or effect of specifying name property clusterkey
attribute?
it looks you've hit driver bug in mapper/linq components. i've created ticket track it: csharp-507
luckily, there's workaround: including columnattribute
along clustering key, in case be:
[column("stringtext")] [clusteringkey] public string stringval;
i've included failing test in repository: https://github.com/datastax/csharp-driver/commit/9917bfff4ef569525a6df845f35d31d817e79dc0
Comments
Post a Comment