Permalink
Browse files

moved provider to cassandra column family object since it made more s…

…ense there
  • Loading branch information...
1 parent c06e928 commit 9ee2ff9a171ce2544362180e5959601d9461f303 @nberardi nberardi committed Nov 2, 2011
Showing with 196 additions and 296 deletions.
  1. +7 −1 src/BaseCassandraColumnFamily.cs
  2. +1 −1 src/CassandraColumnFamily`1.cs
  3. +2 −3 src/FluentCassandra.csproj
  4. +27 −96 src/Linq/{CqlQueryProvider.cs → CassandraColumnFamily`1+QueryProvider.cs}
  5. +18 −13 src/Linq/CqlQuery.cs
  6. +13 −8 src/Linq/CqlQueryEvaluator.cs
  7. +0 −28 src/Linq/CqlQueryExtensions.cs
  8. +13 −0 src/Linq/ICqlRow.cs
  9. +2 −2 src/Operations/ColumnCount.cs
  10. +5 −32 src/Operations/ColumnFamilyOperation.cs
  11. +4 −3 src/Operations/ExecuteCqlQuery.cs
  12. +2 −2 src/Operations/GetColumn.cs
  13. +2 −2 src/Operations/GetColumnFamilyIndexedSlices.cs
  14. +2 −2 src/Operations/GetColumnFamilyRangeSlices.cs
  15. +3 −3 src/Operations/GetColumnFamilySlice.cs
  16. +2 −2 src/Operations/GetSuperColumn.cs
  17. +5 −5 src/Operations/GetSuperColumnFamilyIndexedSlices.cs
  18. +5 −5 src/Operations/GetSuperColumnFamilyRangeSlices.cs
  19. +3 −3 src/Operations/GetSuperColumnFamilySlice.cs
  20. +3 −3 src/Operations/GetSuperColumnIndexedSlices.cs
  21. +3 −3 src/Operations/GetSuperColumnRangeSlices.cs
  22. +3 −3 src/Operations/GetSuperColumnSlice.cs
  23. +2 −2 src/Operations/InsertColumn.cs
  24. +2 −2 src/Operations/MultiGetColumnCount.cs
  25. +4 −4 src/Operations/MultiGetColumnFamilySlice.cs
  26. +5 −5 src/Operations/MultiGetSuperColumnFamilySlice.cs
  27. +3 −3 src/Operations/MultiGetSuperColumnSlice.cs
  28. +2 −2 src/Operations/RemoveColumn.cs
  29. +2 −2 src/Operations/RemoveKey.cs
  30. +2 −2 src/Operations/RemoveSuperColumn.cs
  31. +2 −2 src/Operations/Truncate.cs
  32. +5 −1 test/FluentCassandra.Sandbox/FluentCassandra.Sandbox.csproj
  33. +3 −3 test/FluentCassandra.Sandbox/Program.cs
  34. +3 −0 test/FluentCassandra.Sandbox/app.config
  35. +36 −48 test/FluentCassandra.Tests/Linq/LinqTest.cs
View
8 src/BaseCassandraColumnFamily.cs
@@ -79,7 +79,8 @@ public TResult ExecuteOperation<TResult>(ColumnFamilyOperation<TResult> action,
LastError = null;
TResult result;
- bool success = action.TryExecute(this, out result);
+ action.ColumnFamily = this;
+ bool success = action.TryExecute(out result);
if (!success)
LastError = action.Error;
@@ -116,5 +117,10 @@ TResult ICassandraQueryProvider.Execute<TResult>(ICassandraQueryable query, Func
}
#endregion
+
+ public override string ToString()
+ {
+ return FamilyName;
+ }
}
}
View
2 src/CassandraColumnFamily`1.cs
@@ -3,7 +3,7 @@
namespace FluentCassandra
{
- public class CassandraColumnFamily<CompareWith> : BaseCassandraColumnFamily
+ public partial class CassandraColumnFamily<CompareWith> : BaseCassandraColumnFamily
where CompareWith : CassandraType
{
public CassandraColumnFamily(CassandraContext context, string columnFamily)
View
5 src/FluentCassandra.csproj
@@ -164,9 +164,8 @@
<Compile Include="CassandraColumnFamilyOperations.cs" />
<Compile Include="Linq\CqlQuery.cs" />
<Compile Include="Linq\CqlQueryEvaluator.cs" />
- <Compile Include="Linq\CqlQueryExtensions.cs" />
- <Compile Include="Linq\CqlQueryProvider.cs" />
- <Compile Include="Linq\List.cs" />
+ <Compile Include="Linq\CassandraColumnFamily`1+QueryProvider.cs" />
+ <Compile Include="Linq\ICqlRow.cs" />
<Compile Include="Operations\BatchMutate.cs" />
<Compile Include="Operations\CassandraIndexClause.cs" />
<Compile Include="Operations\CassandraQueryable.cs" />
View
123 src/Linq/CqlQueryProvider.cs → .../CassandraColumnFamily`1+QueryProvider.cs
@@ -3,90 +3,19 @@
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
-using FluentCassandra.Types;
using FluentCassandra.Operations;
+using FluentCassandra.Types;
+using FluentCassandra.Linq;
-namespace FluentCassandra.Linq
+namespace FluentCassandra
{
- public class CqlQueryProvider : IQueryable, IQueryProvider
+ public partial class CassandraColumnFamily<CompareWith> : IQueryable, IQueryable<ICqlRow<CompareWith>>, IQueryProvider
+ where CompareWith : CassandraType
{
- private CassandraSession _session;
- private string _family;
-
- public CqlQueryProvider(string family)
- : this(new CassandraSession(), family) { }
-
- public CqlQueryProvider(CassandraSession session, string family)
- {
- if (session == null)
- throw new ArgumentNullException("session");
-
- _session = session;
- _family = family;
- }
-
- /// <summary>
- /// The last error that occured during the execution of an operation.
- /// </summary>
- public CassandraException LastError { get; private set; }
-
- /// <summary>
- /// Indicates if errors should be thrown when occuring on opperation.
- /// </summary>
- public bool ThrowErrors { get; set; }
-
- /// <summary>
- /// Execute the column family operation against the connection to the server.
- /// </summary>
- /// <typeparam name="TResult"></typeparam>
- /// <param name="action"></param>
- /// <param name="throwOnError"></param>
- /// <returns></returns>
- public TResult ExecuteOperation<TResult>(Operation<TResult> action, bool? throwOnError = null)
- {
- if (!throwOnError.HasValue)
- throwOnError = ThrowErrors;
-
- CassandraSession _localSession = null;
- if (CassandraSession.Current == null)
- _localSession = new CassandraSession();
-
- try
- {
- LastError = null;
-
- TResult result;
- bool success = action.TryExecute(out result);
-
- if (!success)
- LastError = action.Error;
-
- if (!success && (throwOnError ?? ThrowErrors))
- throw action.Error;
-
- return result;
- }
- finally
- {
- if (_localSession != null)
- _localSession.Dispose();
- }
- }
-
- public string ColumnFamily
- {
- get { return _family; }
- }
-
- public CqlQuery ToQuery()
+ public CqlQuery<CompareWith> ToQuery()
{
var queryable = (IQueryable)this;
- return new CqlQuery(queryable.Expression, this);
- }
-
- public override string ToString()
- {
- return _family;
+ return new CqlQuery<CompareWith>(queryable.Expression, this);
}
#region IEnumerable Members
@@ -99,8 +28,20 @@ public override string ToString()
/// </returns>
IEnumerator IEnumerable.GetEnumerator()
{
- var queryable = (IQueryable)this;
- return ((IEnumerable)queryable.Provider.Execute(queryable.Expression)).GetEnumerator();
+ return ((IEnumerable<IFluentBaseColumnFamily>)this).GetEnumerator();
+ }
+
+ #endregion
+
+ #region IEnumerable<IFluentBaseColumnFamily> Members
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <returns></returns>
+ IEnumerator<ICqlRow<CompareWith>> IEnumerable<ICqlRow<CompareWith>>.GetEnumerator()
+ {
+ return ToQuery().GetEnumerator();
}
#endregion
@@ -116,7 +57,7 @@ IEnumerator IEnumerable.GetEnumerator()
/// </returns>
public virtual Type ElementType
{
- get { return typeof(object); }
+ get { return typeof(IFluentBaseColumnFamily); }
}
/// <summary>
@@ -164,7 +105,7 @@ IQueryable<TElement> IQueryProvider.CreateQuery<TElement>(Expression expression)
if (!typeof(IQueryable<TElement>).IsAssignableFrom(expression.Type))
throw new ApplicationException("'expression' is not assignable from this type of repository.");
- return (IQueryable<TElement>)new CqlQuery(expression, this);
+ return (IQueryable<TElement>)new CqlQuery<CompareWith>(expression, this);
}
/// <summary>
@@ -179,7 +120,7 @@ IQueryable IQueryProvider.CreateQuery(Expression expression)
if (expression == null)
throw new ArgumentNullException("expression");
- return new CqlQuery(expression, this);
+ return new CqlQuery<CompareWith>(expression, this);
}
/// <summary>
@@ -193,7 +134,7 @@ TResult IQueryProvider.Execute<TResult>(Expression expression)
if (!typeof(TResult).IsAssignableFrom(typeof(IFluentBaseColumnFamily)))
throw new CassandraException("'TElement' must inherit from IFluentBaseColumnFamily");
- return (TResult)Execute(expression).FirstOrDefault();
+ return (TResult)new CqlQuery<CompareWith>(expression, this).FirstOrDefault();
}
/// <summary>
@@ -205,19 +146,9 @@ TResult IQueryProvider.Execute<TResult>(Expression expression)
/// </returns>
object IQueryProvider.Execute(Expression expression)
{
- return Execute(expression);
+ return new CqlQuery<CompareWith>(expression, this).GetEnumerator();
}
#endregion
-
- public IEnumerable<IFluentBaseColumnFamily> Execute(Expression expression)
- {
- if (expression == null)
- throw new ArgumentNullException("expression");
-
- var result = CqlQueryEvaluator.GetEvaluator(expression);
- var op = new ExecuteCqlQuery(result.Query);
- return ExecuteOperation(op);
- }
}
-}
+}
View
31 src/Linq/CqlQuery.cs
@@ -3,20 +3,23 @@
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
+using FluentCassandra.Types;
+using FluentCassandra.Operations;
namespace FluentCassandra.Linq
{
- public class CqlQuery : IQueryable, IQueryable<IFluentBaseColumnFamily>
+ public class CqlQuery<CompareWith> : IQueryable, IQueryable<ICqlRow<CompareWith>>
+ where CompareWith : CassandraType
{
private readonly Expression _expression;
- private readonly CqlQueryProvider _provider;
+ private readonly CassandraColumnFamily<CompareWith> _provider;
/// <summary>
/// Initializes a new instance of the <see cref="CqlQuery&lt;T&gt;"/> class.
/// </summary>
/// <param name="expression">The expression.</param>
/// <param name="provider">The provider.</param>
- public CqlQuery(Expression expression, CqlQueryProvider provider)
+ public CqlQuery(Expression expression, CassandraColumnFamily<CompareWith> provider)
{
_expression = expression;
_provider = provider;
@@ -37,15 +40,17 @@ IEnumerator IEnumerable.GetEnumerator()
#endregion
- #region IEnumerable<IFluentBaseColumnFamily> Members
+ #region IEnumerable<ICqlRow<CompareWith>> Members
- public IEnumerator<IFluentBaseColumnFamily> GetEnumerator()
+ /// <summary>
+ ///
+ /// </summary>
+ /// <returns></returns>
+ public IEnumerator<ICqlRow<CompareWith>> GetEnumerator()
{
- if (ElementType.IsAnonymousType())
- throw new NotSupportedException(
- "Please call the AsTypelessQuery() on this query, because anonymous types are not supported.");
-
- return Provider.Execute(Expression).GetEnumerator();
+ var result = CqlQueryEvaluator<CompareWith>.GetEvaluator<CompareWith>(Expression);
+ var op = new ExecuteCqlQuery<CompareWith>(result.Query);
+ return Provider.ExecuteOperation(op).GetEnumerator();
}
#endregion
@@ -61,7 +66,7 @@ public IEnumerator<IFluentBaseColumnFamily> GetEnumerator()
/// </returns>
public virtual Type ElementType
{
- get { return typeof(object); }
+ get { return typeof(IFluentBaseColumnFamily); }
}
/// <summary>
@@ -83,7 +88,7 @@ public Expression Expression
/// <returns>
/// The <see cref="T:System.Linq.IQueryProvider"/> that is associated with this data source.
/// </returns>
- public CqlQueryProvider Provider
+ public CassandraColumnFamily<CompareWith> Provider
{
get { return _provider; }
}
@@ -104,7 +109,7 @@ IQueryProvider IQueryable.Provider
/// <returns></returns>
public override string ToString()
{
- return CqlQueryEvaluator.GetCql(Expression);
+ return CqlQueryEvaluator<CompareWith>.GetCql<CompareWith>(Expression);
}
}
}
View
21 src/Linq/CqlQueryEvaluator.cs
@@ -3,11 +3,13 @@
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
+using FluentCassandra.Types;
namespace FluentCassandra.Linq
{
/// <see href="https://github.com/apache/cassandra/blob/trunk/doc/cql/CQL.textile"/>
- internal class CqlQueryEvaluator
+ internal class CqlQueryEvaluator<CompareWith>
+ where CompareWith : CassandraType
{
private string _columnFamily;
@@ -48,9 +50,10 @@ private string Fields
private string WhereCriteria { get; set; }
- private void AddTable(CqlQueryProvider provider)
+ private void AddTable<CompareWith>(CassandraColumnFamily<CompareWith> provider)
+ where CompareWith : CassandraType
{
- _columnFamily = provider.ColumnFamily;
+ _columnFamily = provider.FamilyName;
}
private void AddField(Expression exp)
@@ -105,15 +108,17 @@ private static string GetPropertyName(Expression exp)
#region Expression Parsing
- public static string GetCql(Expression expression)
+ public static string GetCql<CompareWith>(Expression expression)
+ where CompareWith : CassandraType
{
- var eval = GetEvaluator(expression);
+ var eval = GetEvaluator<CompareWith>(expression);
return eval.Query;
}
- public static CqlQueryEvaluator GetEvaluator(Expression expression)
+ public static CqlQueryEvaluator<CompareWith> GetEvaluator<CompareWith>(Expression expression)
+ where CompareWith : CassandraType
{
- var eval = new CqlQueryEvaluator();
+ var eval = new CqlQueryEvaluator<CompareWith>();
eval.Evaluate(expression);
return eval;
@@ -144,7 +149,7 @@ private void Evaluate(Expression exp, Action<string> call = null)
break;
case ExpressionType.Constant:
- AddTable(((ConstantExpression)exp).Value as CqlQueryProvider);
+ AddTable(((ConstantExpression)exp).Value as CassandraColumnFamily<CompareWith>);
break;
}
}
View
28 src/Linq/CqlQueryExtensions.cs
@@ -1,28 +0,0 @@
-using System;
-using System.Linq;
-using System.Runtime.CompilerServices;
-
-namespace FluentCassandra.Linq
-{
- internal static class CqlQueryExtensions
- {
- public static Boolean IsAnonymousType(this Type type)
- {
- if (type == null) return false;
-
- var hasCompilerGeneratedAttribute = type.GetCustomAttributes(typeof(CompilerGeneratedAttribute), false).Count() > 0;
- var nameContainsAnonymousType = type.FullName.Contains("AnonymousType");
- var isAnonymousType = hasCompilerGeneratedAttribute && nameContainsAnonymousType;
-
- return isAnonymousType;
- }
-
- public static IQueryable AsTypelessQuery(this IQueryable queryable)
- {
- if (queryable is CqlQuery)
- return new CqlQuery(queryable.Expression, (CqlQueryProvider)queryable.Provider);
-
- return queryable;
- }
- }
-}
View
13 src/Linq/ICqlRow.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Linq;
+using FluentCassandra.Types;
+
+namespace FluentCassandra.Linq
+{
+ public interface ICqlRow<CompareWith>
+ where CompareWith : CassandraType
+ {
+ BytesType Key { get; set; }
+ BytesType this[CompareWith columnName] { get; }
+ }
+}
View
4 src/Operations/ColumnCount.cs
@@ -18,10 +18,10 @@ public class ColumnCount : ColumnFamilyOperation<int>
#region ICassandraAction<int> Members
- public override int Execute(BaseCassandraColumnFamily columnFamily)
+ public override int Execute()
{
var parent = new ColumnParent {
- Column_family = columnFamily.FamilyName
+ Column_family = ColumnFamily.FamilyName
};
if (SuperColumnName != null)
View
37 src/Operations/ColumnFamilyOperation.cs
@@ -1,43 +1,16 @@
using System;
-using Apache.Cassandra;
-using System.Diagnostics;
namespace FluentCassandra.Operations
{
- public abstract class ColumnFamilyOperation<TResult>
+ public abstract class ColumnFamilyOperation<TResult> : Operation<TResult>
{
- public ColumnFamilyOperation()
- {
- HasError = false;
- }
+ public ColumnFamilyOperation() { }
- public bool HasError { get; protected set; }
+ public BaseCassandraColumnFamily ColumnFamily { get; set; }
- public CassandraException Error { get; protected set; }
-
- public virtual bool TryExecute(BaseCassandraColumnFamily columnFamily, out TResult result)
+ public override TResult Execute()
{
- try
- {
- result = Execute(columnFamily);
- }
- catch (Exception exc)
- {
- Debug.WriteLine(exc);
-
- string message = exc.Message;
-
- if (exc is InvalidRequestException)
- message = ((InvalidRequestException)exc).Why;
-
- result = default(TResult);
- HasError = true;
- Error = new CassandraException(message, exc);
- }
-
- return !HasError;
+ return Execute();
}
-
- public abstract TResult Execute(BaseCassandraColumnFamily columnFamily);
}
}
View
7 src/Operations/ExecuteCqlQuery.cs
@@ -1,20 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Text;
using FluentCassandra.Types;
using System.IO;
using System.IO.Compression;
+using FluentCassandra.Linq;
namespace FluentCassandra.Operations
{
- public class ExecuteCqlQuery : Operation<IEnumerable<IFluentBaseColumnFamily>>
+ public class ExecuteCqlQuery<CompareWith> : ColumnFamilyOperation<IEnumerable<ICqlRow<CompareWith>>>
+ where CompareWith : CassandraType
{
public UTF8Type CqlQuery { get; private set; }
public bool CompressCqlQuery { get; private set; }
- public override IEnumerable<IFluentBaseColumnFamily> Execute()
+ public override IEnumerable<ICqlRow<CompareWith>> Execute()
{
byte[] query = CqlQuery;
View
4 src/Operations/GetColumn.cs
@@ -17,10 +17,10 @@ public class GetColumn<CompareWith> : ColumnFamilyOperation<IFluentColumn<Compar
public CassandraType ColumnName { get; private set; }
- public override IFluentColumn<CompareWith> Execute(BaseCassandraColumnFamily columnFamily)
+ public override IFluentColumn<CompareWith> Execute()
{
var path = new ColumnPath {
- Column_family = columnFamily.FamilyName
+ Column_family = ColumnFamily.FamilyName
};
if (SuperColumnName != null)
View
4 src/Operations/GetColumnFamilyIndexedSlices.cs
@@ -15,9 +15,9 @@ public class GetColumnFamilyIndexedSlices<CompareWith> : QueryableColumnFamilyOp
public CassandraIndexClause IndexClause { get; private set; }
- public override IEnumerable<IFluentColumnFamily<CompareWith>> Execute(BaseCassandraColumnFamily columnFamily)
+ public override IEnumerable<IFluentColumnFamily<CompareWith>> Execute()
{
- return GetFamilies(columnFamily);
+ return GetFamilies(ColumnFamily);
}
private IEnumerable<IFluentColumnFamily<CompareWith>> GetFamilies(BaseCassandraColumnFamily columnFamily)
View
4 src/Operations/GetColumnFamilyRangeSlices.cs
@@ -15,9 +15,9 @@ public class GetColumnFamilyRangeSlices<CompareWith> : QueryableColumnFamilyOper
public CassandraKeyRange KeyRange { get; private set; }
- public override IEnumerable<IFluentColumnFamily<CompareWith>> Execute(BaseCassandraColumnFamily columnFamily)
+ public override IEnumerable<IFluentColumnFamily<CompareWith>> Execute()
{
- return GetFamilies(columnFamily);
+ return GetFamilies(ColumnFamily);
}
private IEnumerable<IFluentColumnFamily<CompareWith>> GetFamilies(BaseCassandraColumnFamily columnFamily)
View
6 src/Operations/GetColumnFamilySlice.cs
@@ -16,10 +16,10 @@ public class GetColumnFamilySlice<CompareWith> : ColumnFamilyOperation<IFluentCo
public CassandraSlicePredicate SlicePredicate { get; private set; }
- public override IFluentColumnFamily<CompareWith> Execute(BaseCassandraColumnFamily columnFamily)
+ public override IFluentColumnFamily<CompareWith> Execute()
{
- var result = new FluentColumnFamily<CompareWith>(Key, columnFamily.FamilyName, GetColumns(columnFamily));
- columnFamily.Context.Attach(result);
+ var result = new FluentColumnFamily<CompareWith>(Key, ColumnFamily.FamilyName, GetColumns(ColumnFamily));
+ ColumnFamily.Context.Attach(result);
result.MutationTracker.Clear();
return result;
View
4 src/Operations/GetSuperColumn.cs
@@ -16,10 +16,10 @@ public class GetSuperColumn<CompareWith, CompareSubcolumnWith> : ColumnFamilyOpe
public CassandraType SuperColumnName { get; private set; }
- public override IFluentSuperColumn<CompareWith, CompareSubcolumnWith> Execute(BaseCassandraColumnFamily columnFamily)
+ public override IFluentSuperColumn<CompareWith, CompareSubcolumnWith> Execute()
{
var path = new ColumnPath {
- Column_family = columnFamily.FamilyName
+ Column_family = ColumnFamily.FamilyName
};
if (SuperColumnName != null)
View
10 src/Operations/GetSuperColumnFamilyIndexedSlices.cs
@@ -16,7 +16,7 @@ public class GetSuperColumnFamilyIndexedSlices<CompareWith, CompareSubcolumnWith
public CassandraIndexClause IndexClause { get; private set; }
- public override IEnumerable<IFluentSuperColumnFamily<CompareWith, CompareSubcolumnWith>> Execute(BaseCassandraColumnFamily columnFamily)
+ public override IEnumerable<IFluentSuperColumnFamily<CompareWith, CompareSubcolumnWith>> Execute()
{
CassandraSession _localSession = null;
if (CassandraSession.Current == null)
@@ -25,7 +25,7 @@ public class GetSuperColumnFamilyIndexedSlices<CompareWith, CompareSubcolumnWith
try
{
var parent = new ColumnParent {
- Column_family = columnFamily.FamilyName
+ Column_family = ColumnFamily.FamilyName
};
var output = CassandraSession.Current.GetClient().get_indexed_slices(
@@ -37,14 +37,14 @@ public class GetSuperColumnFamilyIndexedSlices<CompareWith, CompareSubcolumnWith
foreach (var result in output)
{
- var r = new FluentSuperColumnFamily<CompareWith, CompareSubcolumnWith>(result.Key, columnFamily.FamilyName, result.Columns.Select(col => {
+ var r = new FluentSuperColumnFamily<CompareWith, CompareSubcolumnWith>(result.Key, ColumnFamily.FamilyName, result.Columns.Select(col => {
var superCol = Helper.ConvertSuperColumnToFluentSuperColumn<CompareWith, CompareSubcolumnWith>(col.Super_column);
- columnFamily.Context.Attach(superCol);
+ ColumnFamily.Context.Attach(superCol);
superCol.MutationTracker.Clear();
return superCol;
}));
- columnFamily.Context.Attach(r);
+ ColumnFamily.Context.Attach(r);
r.MutationTracker.Clear();
yield return r;
View
10 src/Operations/GetSuperColumnFamilyRangeSlices.cs
@@ -16,7 +16,7 @@ public class GetSuperColumnFamilyRangeSlices<CompareWith, CompareSubcolumnWith>
public CassandraKeyRange KeyRange { get; private set; }
- public override IEnumerable<IFluentSuperColumnFamily<CompareWith, CompareSubcolumnWith>> Execute(BaseCassandraColumnFamily columnFamily)
+ public override IEnumerable<IFluentSuperColumnFamily<CompareWith, CompareSubcolumnWith>> Execute()
{
CassandraSession _localSession = null;
if (CassandraSession.Current == null)
@@ -25,7 +25,7 @@ public class GetSuperColumnFamilyRangeSlices<CompareWith, CompareSubcolumnWith>
try
{
var parent = new ColumnParent {
- Column_family = columnFamily.FamilyName
+ Column_family = ColumnFamily.FamilyName
};
var output = CassandraSession.Current.GetClient().get_range_slices(
@@ -37,14 +37,14 @@ public class GetSuperColumnFamilyRangeSlices<CompareWith, CompareSubcolumnWith>
foreach (var result in output)
{
- var r = new FluentSuperColumnFamily<CompareWith, CompareSubcolumnWith>(result.Key, columnFamily.FamilyName, result.Columns.Select(col => {
+ var r = new FluentSuperColumnFamily<CompareWith, CompareSubcolumnWith>(result.Key, ColumnFamily.FamilyName, result.Columns.Select(col => {
var superCol = Helper.ConvertSuperColumnToFluentSuperColumn<CompareWith, CompareSubcolumnWith>(col.Super_column);
- columnFamily.Context.Attach(superCol);
+ ColumnFamily.Context.Attach(superCol);
superCol.MutationTracker.Clear();
return superCol;
}));
- columnFamily.Context.Attach(r);
+ ColumnFamily.Context.Attach(r);
r.MutationTracker.Clear();
yield return r;
View
6 src/Operations/GetSuperColumnFamilySlice.cs
@@ -17,10 +17,10 @@ public class GetSuperColumnFamilySlice<CompareWith, CompareSubcolumnWith> : Colu
public CassandraSlicePredicate SlicePredicate { get; private set; }
- public override FluentSuperColumnFamily<CompareWith, CompareSubcolumnWith> Execute(BaseCassandraColumnFamily columnFamily)
+ public override FluentSuperColumnFamily<CompareWith, CompareSubcolumnWith> Execute()
{
- var result = new FluentSuperColumnFamily<CompareWith, CompareSubcolumnWith>(Key, columnFamily.FamilyName, GetColumns(columnFamily));
- columnFamily.Context.Attach(result);
+ var result = new FluentSuperColumnFamily<CompareWith, CompareSubcolumnWith>(Key, ColumnFamily.FamilyName, GetColumns(ColumnFamily));
+ ColumnFamily.Context.Attach(result);
result.MutationTracker.Clear();
return result;
View
6 src/Operations/GetSuperColumnIndexedSlices.cs
@@ -18,7 +18,7 @@ public class GetSuperColumnIndexedSlices<CompareWith, CompareSubcolumnWith> : Qu
public CassandraType SuperColumnName { get; private set; }
- public override IEnumerable<IFluentSuperColumn<CompareWith, CompareSubcolumnWith>> Execute(BaseCassandraColumnFamily columnFamily)
+ public override IEnumerable<IFluentSuperColumn<CompareWith, CompareSubcolumnWith>> Execute()
{
CassandraSession _localSession = null;
if (CassandraSession.Current == null)
@@ -27,7 +27,7 @@ public class GetSuperColumnIndexedSlices<CompareWith, CompareSubcolumnWith> : Qu
try
{
var parent = new ColumnParent {
- Column_family = columnFamily.FamilyName
+ Column_family = ColumnFamily.FamilyName
};
if (SuperColumnName != null)
@@ -45,7 +45,7 @@ public class GetSuperColumnIndexedSlices<CompareWith, CompareSubcolumnWith> : Qu
var r = new FluentSuperColumn<CompareWith, CompareSubcolumnWith>(result.Columns.Select(col => {
return Helper.ConvertColumnToFluentColumn<CompareSubcolumnWith>(col.Column);
}));
- columnFamily.Context.Attach(r);
+ ColumnFamily.Context.Attach(r);
r.MutationTracker.Clear();
yield return r;
View
6 src/Operations/GetSuperColumnRangeSlices.cs
@@ -18,7 +18,7 @@ public class GetSuperColumnRangeSlices<CompareWith, CompareSubcolumnWith> : Quer
public CassandraType SuperColumnName { get; private set; }
- public override IEnumerable<IFluentSuperColumn<CompareWith, CompareSubcolumnWith>> Execute(BaseCassandraColumnFamily columnFamily)
+ public override IEnumerable<IFluentSuperColumn<CompareWith, CompareSubcolumnWith>> Execute()
{
CassandraSession _localSession = null;
if (CassandraSession.Current == null)
@@ -27,7 +27,7 @@ public class GetSuperColumnRangeSlices<CompareWith, CompareSubcolumnWith> : Quer
try
{
var parent = new ColumnParent {
- Column_family = columnFamily.FamilyName
+ Column_family = ColumnFamily.FamilyName
};
if (SuperColumnName != null)
@@ -45,7 +45,7 @@ public class GetSuperColumnRangeSlices<CompareWith, CompareSubcolumnWith> : Quer
var r = new FluentSuperColumn<CompareWith, CompareSubcolumnWith>(result.Columns.Select(col => {
return Helper.ConvertColumnToFluentColumn<CompareSubcolumnWith>(col.Column);
}));
- columnFamily.Context.Attach(r);
+ ColumnFamily.Context.Attach(r);
r.MutationTracker.Clear();
yield return r;
View
6 src/Operations/GetSuperColumnSlice.cs
@@ -19,10 +19,10 @@ public class GetSuperColumnSlice<CompareWith, CompareSubcolumnWith> : ColumnFami
public CassandraSlicePredicate SlicePredicate { get; private set; }
- public override FluentSuperColumn<CompareWith, CompareSubcolumnWith> Execute(BaseCassandraColumnFamily columnFamily)
+ public override FluentSuperColumn<CompareWith, CompareSubcolumnWith> Execute()
{
- var result = new FluentSuperColumn<CompareWith, CompareSubcolumnWith>(GetColumns(columnFamily));
- columnFamily.Context.Attach(result);
+ var result = new FluentSuperColumn<CompareWith, CompareSubcolumnWith>(GetColumns(ColumnFamily));
+ ColumnFamily.Context.Attach(result);
result.MutationTracker.Clear();
return result;
View
4 src/Operations/InsertColumn.cs
@@ -24,10 +24,10 @@ public class InsertColumn : ColumnFamilyOperation<Void>
#region ICassandraAction<Void> Members
- public override Void Execute(BaseCassandraColumnFamily columnFamily)
+ public override Void Execute()
{
var parent = new ColumnParent {
- Column_family = columnFamily.FamilyName,
+ Column_family = ColumnFamily.FamilyName,
};
if (SuperColumnName != null)
View
4 src/Operations/MultiGetColumnCount.cs
@@ -14,7 +14,7 @@ public class MultiGetColumnCount : ColumnFamilyOperation<IDictionary<BytesType,
public CassandraSlicePredicate SlicePredicate { get; internal protected set; }
- public override IDictionary<BytesType, int> Execute(BaseCassandraColumnFamily columnFamily)
+ public override IDictionary<BytesType, int> Execute()
{
CassandraSession _localSession = null;
if (CassandraSession.Current == null)
@@ -23,7 +23,7 @@ public class MultiGetColumnCount : ColumnFamilyOperation<IDictionary<BytesType,
try
{
var parent = new ColumnParent {
- Column_family = columnFamily.FamilyName
+ Column_family = ColumnFamily.FamilyName
};
if (SuperColumnName != null)
View
8 src/Operations/MultiGetColumnFamilySlice.cs
@@ -15,7 +15,7 @@ public class MultiGetColumnFamilySlice<CompareWith> : QueryableColumnFamilyOpera
public List<BytesType> Keys { get; private set; }
- public override IEnumerable<IFluentColumnFamily<CompareWith>> Execute(BaseCassandraColumnFamily columnFamily)
+ public override IEnumerable<IFluentColumnFamily<CompareWith>> Execute()
{
CassandraSession _localSession = null;
if (CassandraSession.Current == null)
@@ -24,7 +24,7 @@ public override IEnumerable<IFluentColumnFamily<CompareWith>> Execute(BaseCassan
try
{
var parent = new ColumnParent {
- Column_family = columnFamily.FamilyName
+ Column_family = ColumnFamily.FamilyName
};
var output = CassandraSession.Current.GetClient().multiget_slice(
@@ -36,10 +36,10 @@ public override IEnumerable<IFluentColumnFamily<CompareWith>> Execute(BaseCassan
foreach (var result in output)
{
- var r = new FluentColumnFamily<CompareWith>(result.Key, columnFamily.FamilyName, result.Value.Select(col => {
+ var r = new FluentColumnFamily<CompareWith>(result.Key, ColumnFamily.FamilyName, result.Value.Select(col => {
return Helper.ConvertColumnToFluentColumn<CompareWith>(col.Column);
}));
- columnFamily.Context.Attach(r);
+ ColumnFamily.Context.Attach(r);
r.MutationTracker.Clear();
yield return r;
View
10 src/Operations/MultiGetSuperColumnFamilySlice.cs
@@ -16,7 +16,7 @@ public class MultiGetSuperColumnFamilySlice<CompareWith, CompareSubcolumnWith> :
public List<BytesType> Keys { get; private set; }
- public override IEnumerable<IFluentSuperColumnFamily<CompareWith, CompareSubcolumnWith>> Execute(BaseCassandraColumnFamily columnFamily)
+ public override IEnumerable<IFluentSuperColumnFamily<CompareWith, CompareSubcolumnWith>> Execute()
{
CassandraSession _localSession = null;
if (CassandraSession.Current == null)
@@ -25,7 +25,7 @@ public class MultiGetSuperColumnFamilySlice<CompareWith, CompareSubcolumnWith> :
try
{
var parent = new ColumnParent {
- Column_family = columnFamily.FamilyName
+ Column_family = ColumnFamily.FamilyName
};
var output = CassandraSession.Current.GetClient().multiget_slice(
@@ -37,14 +37,14 @@ public class MultiGetSuperColumnFamilySlice<CompareWith, CompareSubcolumnWith> :
foreach (var result in output)
{
- var r = new FluentSuperColumnFamily<CompareWith, CompareSubcolumnWith>(result.Key, columnFamily.FamilyName, result.Value.Select(col => {
+ var r = new FluentSuperColumnFamily<CompareWith, CompareSubcolumnWith>(result.Key, ColumnFamily.FamilyName, result.Value.Select(col => {
var superCol = Helper.ConvertSuperColumnToFluentSuperColumn<CompareWith, CompareSubcolumnWith>(col.Super_column);
- columnFamily.Context.Attach(superCol);
+ ColumnFamily.Context.Attach(superCol);
superCol.MutationTracker.Clear();
return superCol;
}));
- columnFamily.Context.Attach(r);
+ ColumnFamily.Context.Attach(r);
r.MutationTracker.Clear();
yield return r;
View
6 src/Operations/MultiGetSuperColumnSlice.cs
@@ -18,7 +18,7 @@ public class MultiGetSuperColumnSlice<CompareWith, CompareSubcolumnWith> : Query
public CassandraType SuperColumnName { get; private set; }
- public override IEnumerable<IFluentSuperColumn<CompareWith, CompareSubcolumnWith>> Execute(BaseCassandraColumnFamily columnFamily)
+ public override IEnumerable<IFluentSuperColumn<CompareWith, CompareSubcolumnWith>> Execute()
{
CassandraSession _localSession = null;
if (CassandraSession.Current == null)
@@ -27,7 +27,7 @@ public class MultiGetSuperColumnSlice<CompareWith, CompareSubcolumnWith> : Query
try
{
var parent = new ColumnParent {
- Column_family = columnFamily.FamilyName
+ Column_family = ColumnFamily.FamilyName
};
if (SuperColumnName != null)
@@ -45,7 +45,7 @@ public class MultiGetSuperColumnSlice<CompareWith, CompareSubcolumnWith> : Query
var r = new FluentSuperColumn<CompareWith, CompareSubcolumnWith>(result.Value.Select(col => {
return Helper.ConvertColumnToFluentColumn<CompareSubcolumnWith>(col.Column);
}));
- columnFamily.Context.Attach(r);
+ ColumnFamily.Context.Attach(r);
r.MutationTracker.Clear();
yield return r;
View
4 src/Operations/RemoveColumn.cs
@@ -16,10 +16,10 @@ public class RemoveColumn : ColumnFamilyOperation<Void>
public CassandraType ColumnName { get; private set; }
- public override Void Execute(BaseCassandraColumnFamily columnFamily)
+ public override Void Execute()
{
var path = new ColumnPath {
- Column_family = columnFamily.FamilyName
+ Column_family = ColumnFamily.FamilyName
};
if (SuperColumnName != null)
View
4 src/Operations/RemoveKey.cs
@@ -12,10 +12,10 @@ public class RemoveKey : ColumnFamilyOperation<Void>
public BytesType Key { get; private set; }
- public override Void Execute(BaseCassandraColumnFamily columnFamily)
+ public override Void Execute()
{
var path = new ColumnPath {
- Column_family = columnFamily.FamilyName
+ Column_family = ColumnFamily.FamilyName
};
CassandraSession.Current.GetClient().remove(
View
4 src/Operations/RemoveSuperColumn.cs
@@ -14,10 +14,10 @@ public class RemoveSuperColumn : ColumnFamilyOperation<Void>
public CassandraType SuperColumnName { get; private set; }
- public override Void Execute(BaseCassandraColumnFamily columnFamily)
+ public override Void Execute()
{
var path = new ColumnPath {
- Column_family = columnFamily.FamilyName
+ Column_family = ColumnFamily.FamilyName
};
if (SuperColumnName != null)
View
4 src/Operations/Truncate.cs
@@ -4,9 +4,9 @@ namespace FluentCassandra.Operations
{
public class Truncate : ColumnFamilyOperation<Void>
{
- public override Void Execute(BaseCassandraColumnFamily columnFamily)
+ public override Void Execute()
{
- CassandraSession.Current.GetClient().truncate(columnFamily.FamilyName);
+ CassandraSession.Current.GetClient().truncate(ColumnFamily.FamilyName);
return new Void();
}
View
6 test/FluentCassandra.Sandbox/FluentCassandra.Sandbox.csproj
@@ -11,7 +11,8 @@
<RootNamespace>FluentCassandra.Sandbox</RootNamespace>
<AssemblyName>FluentCassandra.Sandbox</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <TargetFrameworkProfile>Client</TargetFrameworkProfile>
+ <TargetFrameworkProfile>
+ </TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
@@ -53,6 +54,9 @@
<Name>FluentCassandra</Name>
</ProjectReference>
</ItemGroup>
+ <ItemGroup>
+ <None Include="app.config" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
View
6 test/FluentCassandra.Sandbox/Program.cs
@@ -2,9 +2,9 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading;
-using FluentCassandra.Types;
-using FluentCassandra.Connections;
using Apache.Cassandra;
+using FluentCassandra.Connections;
+using FluentCassandra.Types;
namespace FluentCassandra.Sandbox
{
@@ -48,7 +48,7 @@ private static void Main(string[] args)
using (var db = new CassandraContext(keyspace: keyspaceName, server: server))
{
var family = db.GetColumnFamily<UTF8Type, UTF8Type>("Posts");
-
+
// create post
dynamic post = family.CreateRecord(key: "first-blog-post");
View
3 test/FluentCassandra.Sandbox/app.config
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<configuration>
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
View
84 test/FluentCassandra.Tests/Linq/LinqTest.cs
@@ -1,5 +1,6 @@
using System.Linq;
using NUnit.Framework;
+using FluentCassandra.Linq;
namespace FluentCassandra.Tests.Linq
{
@@ -13,16 +14,16 @@ private string ScrubLineBreaks(string query)
private void AreEqual(string expected, string actual)
{
- ScrubLineBreaks(expected).IsEqualTo(ScrubLineBreaks(actual));
+ Assert.AreEqual(ScrubLineBreaks(expected), ScrubLineBreaks(actual));
}
[Test]
public void Provider()
{
- var conn = Mocks.GetMockConnection();
+ var session = new CassandraSession();
var expected = "SELECT * FROM Users";
- var query = new SqlMapperQueryProvider<User>(conn, "Users").ToQuery();
+ var query = new CqlQueryProvider(session, "Users").ToQuery();
var actual = query.ToString();
@@ -32,11 +33,11 @@ public void Provider()
[Test]
public void SELECT()
{
- var conn = Mocks.GetMockConnection();
+ var session = new CassandraSession();
var expected = "SELECT * FROM Users";
var query =
- from user in new SqlMapperQueryProvider<User>(conn, "Users")
+ from user in new CqlQueryProvider(session, "Users")
select user;
var actual = query.ToString();
@@ -47,11 +48,11 @@ public void SELECT()
[Test]
public void SELECT_One_Column()
{
- var conn = Mocks.GetMockConnection();
+ var session = new CassandraSession();
var expected = "SELECT Age FROM Users";
var query =
- from user in new SqlMapperQueryProvider<User>(conn, "Users")
+ from user in new CqlQueryProvider(session, "Users")
select new { user.Age };
var actual = query.ToString();
@@ -60,26 +61,13 @@ public void SELECT_One_Column()
}
[Test]
- public void SELECT_One_SUM_Column()
- {
- var expected = "SELECT SUM(Age) FROM Users";
- var actual = "";
- var conn = Mocks.GetMockConnection(cmd => actual = cmd);
-
- new SqlMapperQueryProvider<User>(conn, "Users")
- .Sum(x => x.Age);
-
- AreEqual(expected, actual);
- }
-
- [Test]
public void WHERE_One_Parameter()
{
- var conn = Mocks.GetMockConnection();
+ var session = new CassandraSession();
var expected = "SELECT * FROM Users WHERE Id = @param0";
var query =
- from user in new SqlMapperQueryProvider<User>(conn, "Users")
+ from user in new CqlQueryProvider(session, "Users")
where user.Id == 1234
select user;
@@ -91,11 +79,11 @@ public void WHERE_One_Parameter()
[Test]
public void WHERE_Two_AND_Parameter()
{
- var conn = Mocks.GetMockConnection();
+ var session = new CassandraSession();
var expected = "SELECT * FROM Users WHERE (Id = @param0 AND Age = @param1)";
var query =
- from user in new SqlMapperQueryProvider<User>(conn, "Users")
+ from user in new CqlQueryProvider(session, "Users")
where user.Id == 1234 && user.Age == 10
select user;
@@ -107,11 +95,11 @@ public void WHERE_Two_AND_Parameter()
[Test]
public void WHERE_Two_OR_Parameter()
{
- var conn = Mocks.GetMockConnection();
+ var session = new CassandraSession();
var expected = "SELECT * FROM Users WHERE (Id = @param0 OR Age = @param1)";
var query =
- from user in new SqlMapperQueryProvider<User>(conn, "Users")
+ from user in new CqlQueryProvider(session, "Users")
where user.Id == 1234 || user.Age == 10
select user;
@@ -123,11 +111,11 @@ public void WHERE_Two_OR_Parameter()
[Test]
public void WHERE_Three_Complex_Parameter()
{
- var conn = Mocks.GetMockConnection();
+ var session = new CassandraSession();
var expected = "SELECT * FROM Users WHERE ((Id = @param0 OR Age = @param1) AND Name = @param2)";
var query =
- from user in new SqlMapperQueryProvider<User>(conn, "Users")
+ from user in new CqlQueryProvider(session, "Users")
where (user.Id == 1234 || user.Age == 10) && user.Name == "Adama"
select user;
@@ -139,11 +127,11 @@ public void WHERE_Three_Complex_Parameter()
[Test]
public void ORDERBY()
{
- var conn = Mocks.GetMockConnection();
+ var session = new CassandraSession();
var expected = "SELECT * FROM Users ORDER BY Age ASC";
var query =
- from user in new SqlMapperQueryProvider<User>(conn, "Users")
+ from user in new CqlQueryProvider(session, "Users")
orderby user.Age
select user;
@@ -155,11 +143,11 @@ orderby user.Age
[Test]
public void ORDERBY_Two_Parameters()
{
- var conn = Mocks.GetMockConnection();
+ var session = new CassandraSession();
var expected = "SELECT * FROM Users ORDER BY Age ASC, Name ASC";
var query =
- from user in new SqlMapperQueryProvider<User>(conn, "Users")
+ from user in new CqlQueryProvider(session, "Users")
orderby user.Age, user.Name
select user;
@@ -171,11 +159,11 @@ public void ORDERBY_Two_Parameters()
[Test]
public void GROUPBY()
{
- var conn = Mocks.GetMockConnection();
+ var session = new CassandraSession();
var expected = "SELECT Age, COUNT(*) FROM Users GROUP BY Age";
var query =
- from user in new SqlMapperQueryProvider<User>(conn, "Users")
+ from user in new CqlQueryProvider(session, "Users")
group user by user.Age;
var actual = query.ToString();
@@ -186,11 +174,11 @@ public void GROUPBY()
[Test]
public void GROUPBY_Two_Parameters()
{
- var conn = Mocks.GetMockConnection();
+ var session = new CassandraSession();
var expected = "SELECT Age, Name, COUNT(*) FROM Users GROUP BY Age, Name";
var query =
- from user in new SqlMapperQueryProvider<User>(conn, "Users")
+ from user in new CqlQueryProvider(session, "Users")
group user by new { user.Age, user.Name };
var actual = query.ToString();
@@ -201,11 +189,11 @@ public void GROUPBY_Two_Parameters()
[Test]
public void GROUPBY_Custom_SELECT()
{
- var conn = Mocks.GetMockConnection();
+ var session = new CassandraSession();
var expected = "SELECT Age FROM Users GROUP BY Age";
var query =
- from user in new SqlMapperQueryProvider<User>(conn, "Users")
+ from user in new CqlQueryProvider(session, "Users")
group user by user.Age into userGroup
select userGroup.Key;
@@ -217,11 +205,11 @@ public void GROUPBY_Custom_SELECT()
[Test]
public void GROUPBY_Two_Parameters_Custom_SELECT()
{
- var conn = Mocks.GetMockConnection();
+ var session = new CassandraSession();
var expected = "SELECT Age, Name FROM Users GROUP BY Age, Name";
var query =
- from user in new SqlMapperQueryProvider<User>(conn, "Users")
+ from user in new CqlQueryProvider(session, "Users")
group user by new { user.Age, user.Name } into userGroup
select userGroup.Key;
@@ -233,11 +221,11 @@ public void GROUPBY_Two_Parameters_Custom_SELECT()
[Test]
public void HAVING()
{
- var conn = Mocks.GetMockConnection();
+ var session = new CassandraSession();
var expected = "SELECT Age FROM Users GROUP BY Age HAVING Age = @param0";
var query =
- from user in new SqlMapperQueryProvider<User>(conn, "Users")
+ from user in new CqlQueryProvider(session, "Users")
group user by new { user.Age } into userGroup
where userGroup.Key.Age == 10
select userGroup.Key;
@@ -250,11 +238,11 @@ public void HAVING()
[Test]
public void HAVING_Two_Parameters()
{
- var conn = Mocks.GetMockConnection();
+ var session = new CassandraSession();
var expected = "SELECT Age, Name FROM Users GROUP BY Age, Name HAVING (Age = @param0 AND Name = @param1)";
var query =
- from user in new SqlMapperQueryProvider<User>(conn, "Users")
+ from user in new CqlQueryProvider(session, "Users")
group user by new { user.Age, user.Name } into userGroup
where userGroup.Key.Age == 10 && userGroup.Key.Name == "Adama"
select userGroup.Key;
@@ -267,11 +255,11 @@ public void HAVING_Two_Parameters()
[Test]
public void WHERE_and_HAVING()
{
- var conn = Mocks.GetMockConnection();
+ var session = new CassandraSession();
var expected = "SELECT Age, Name FROM Users WHERE Age = @param0 GROUP BY Age, Name HAVING Name = @param1";
var query =
- from user in new SqlMapperQueryProvider<User>(conn, "Users")
+ from user in new CqlQueryProvider(session, "Users")
where user.Age == 10
group user by new { user.Age, user.Name } into userGroup
where userGroup.Key.Name == "Adama"
@@ -285,11 +273,11 @@ public void WHERE_and_HAVING()
[Test]
public void WHERE_and_HAVING_and_ORDERBY()
{
- var conn = Mocks.GetMockConnection();
+ var session = new CassandraSession();
var expected = "SELECT Age, Name FROM Users WHERE Age = @param0 GROUP BY Age, Name HAVING Name = @param1 ORDER BY Age ASC";
var query =
- from user in new SqlMapperQueryProvider<User>(conn, "Users")
+ from user in new CqlQueryProvider(session, "Users")
where user.Age == 10
group user by new { user.Age, user.Name } into userGroup
where userGroup.Key.Name == "Adama"

0 comments on commit 9ee2ff9

Please sign in to comment.