I created a composite primary key column family in cassandra
CREATE TABLE rMessage ( Key varchar,msg_id varchar, msg blob, PRIMARY KEY(key,msg_id) );
I am trying to create a record via Fluent cassandra api.
string key = "cat1";
string id = "2";
CompositeType compositeKey = new CompositeType<FluentCassandra.Types.AsciiType, FluentCassandra.Types.AsciiType>(key,id);
FluentColumnFamily record = ColumnFamily.CreateRecord(compositeKey.ToString());
dynamic r = record.AsDynamic();
r.msg = blob;
record.Columns[0].ColumnTimeUntilDeleted = diff;
Context.Attach(record);
Context.SaveChanges();
The above code return error "Not enough bytes to read value of component 0". I couldn't figure out why.
I tried the below approach but still getting the same error "Not enough bytes to read value of component 0".
var blob = CassandraBinaryFormatter.Serialzie(value);
var compositeKey = new CompositeType<FluentCassandra.Types.UTF8Type, FluentCassandra.Types.UTF8Type>(key, value.ID.ToString());
FluentColumnFamily record = ColumnFamily.CreateRecord(key);
record[compositeKey.ToString()] = blob;
Context.Attach(record);
Context.SaveChanges();
Thanks for help.