CompositeType wont serialize properly for col name #120

gillotte opened this Issue Mar 18, 2013 · 1 comment

2 participants


Hi Nick, consider the following

CompositeType colname = new CompositeType(new CassandraType[] { CassandraType.AsciiType, CassandraType.AsciiType });            
        AsciiType k1 = new AsciiType();
        AsciiType k2 = new AsciiType();
        colname.SetValue(new CassandraObject[] { k1, k2 });

        var record = cf.CreateRecord(key);
        record[colname] = colValue;

this fails essentially because this line fails

        var val1 = colname.GetValue(CassandraType.GetCassandraType(typeof(byte[])));

A proposed fix:

Edit CassandraObject's Get Value to include bytetype clause.

public CassandraObject GetValue(CassandraType type)
        if (type.FluentType == GetType())
            return this;

        if (GetType() == typeof(BytesType))
            return GetCassandraObjectFromDatabaseByteArray((byte[])GetValue(), type);

        //NEW CODE
        if (type == CassandraType.BytesType)
            return ToBigEndian();

        return GetCassandraObjectFromObject(GetValue(), type);


@nberardi nberardi closed this Apr 15, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment