2016-09-22 4 views
1

私は、CassandraのDatastax C#ドライバの属性を使用して動作するテストオブジェクトマッピングを取得しようとしています。 DataStax C#DriverのClusterKey属性

CREATE TABLE test.omfieldtest (
    integer int, 
    bigint varint, 
    stringtext text, 
    universal uuid, 
    bool boolean, 
    singleprecision float, 
    variableprecision decimal, 
    PRIMARY KEY ((integer), bigint, stringtext, universal) 
); 

によって定義されたカサンドラの表は、私はその後、mapper.Insert<MappingTest>を使用したら、そのテーブル

[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; 
    } 

にマップする飾らC#クラスを持っているがあり、InvalidQueryExceptionは「未知の問題にスローされますidentifier stringval "。列名と一致するようにプロパティの名前を変更すると、ClusterKeyのNameプロパティの設定に関係なく、すべて正常に動作します。

それでは、ClusterKey属性のNameプロパティを指定する目的は何ですか。

+0

'Cassandra.Mapping.Attributes'名前空間または廃止予定のLinq属性の属性を使用していますか? – jorgebg

+0

'Cassandra.Mapping.Attributes'名前空間のものです。 –

答えて

0

Mapper/Linqコンポーネントでドライバのバグが発生しているようです。私はそれを追跡するためにチケットを作成しました:CSHARP-507

幸いにも、回避策があります:クラスタ化キーと一緒にColumnAttributeを含め、あなたのケースで次のようになります。私も失敗を含めました

[Column("stringtext")] 
[ClusteringKey] 
public string stringVal; 

リポジトリでのテスト: https://github.com/datastax/csharp-driver/commit/9917bfff4ef569525a6df845f35d31d817e79dc0

関連する問題