Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

50 lines (39 sloc) 1.088 kb
using System;
using System.Collections.Generic;
using System.Linq;
using LINQPad;
using FluentCassandra.Linq;
using FluentCassandra.Types;
namespace FluentCassandra.LinqPad
{
public class FluentCassandraMemberProvider<CompareWith> : ICustomMemberProvider
where CompareWith : CassandraObject
{
private IDictionary<string, object> _columns;
private IList<Type> _types;
public FluentCassandraMemberProvider(object objectToWrite)
{
var row = (ICqlRow)objectToWrite;
_columns = new Dictionary<string, object>();
_types = row.Columns.Select(c => c.GetSchema().ValueType.FluentType).ToList();
_types.Insert(0, row.Key.GetType());
_columns.Add("KEY", row.Key.GetValue<string>());
foreach (var c in row.Columns)
_columns.Add(c.ColumnName.GetValue<string>(), c.ColumnValue);
}
#region ICustomMemberProvider Members
public IEnumerable<string> GetNames()
{
return _columns.Keys;
}
public IEnumerable<Type> GetTypes()
{
return _types;
}
public IEnumerable<object> GetValues()
{
return _columns.Values;
}
#endregion
}
}
Jump to Line
Something went wrong with that request. Please try again.