public static CassandraObject GetCassandraObjectFromObject(object obj, CassandraType cassandraType = null)
{
if (cassandraType == null)
{
var sourceType = obj.GetType();
cassandraType = CassandraType.GetCassandraType(sourceType);
}
if (obj == null)
{
return(null);
}
if (obj is CassandraObject)
{
return(((CassandraObject)obj).GetValue(cassandraType));
}
var type = cassandraType.CreateInstance();
if (type == null)
{
return(null);
}
type.SetValue(obj);
return(type);
}