Permalink
Browse files

clean up

  • Loading branch information...
1 parent b9d2f58 commit 6d97c5d57bd03a427343ad79341856f7e4f9d9c4 @nberardi nberardi committed Feb 1, 2012
View
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Linq;
using Apache.Cassandra;
using FluentCassandra.Connections;
using FluentCassandra.Linq;
View
@@ -92,7 +92,7 @@ public void TryCreateColumnFamily<CompareWith>(string columnFamilyName)
});
Debug.WriteLine(result, "keyspace setup");
}
- catch (Exception exc)
+ catch
{
Debug.WriteLine(columnFamilyName + " already exists", "keyspace setup");
}
@@ -116,7 +116,7 @@ public void TryCreateColumnFamily<CompareWith>(string columnFamilyName)
});
Debug.WriteLine(result, "keyspace setup");
}
- catch (Exception exc)
+ catch
{
Debug.WriteLine(columnFamilyName + " already exists", "keyspace setup");
}
View
@@ -2,7 +2,6 @@
namespace FluentCassandra
{
-
public static class GuidGenerator
{
// number of bytes in guid
@@ -19,22 +18,22 @@ public static class GuidGenerator
public const int VersionByteShift = 4;
// indexes within the uuid array for certain boundaries
- private static readonly byte TimestampByte = 0;
- private static readonly byte GuidClockSequenceByte = 8;
- private static readonly byte NodeByte = 10;
+ private const byte TimestampByte = 0;
+ private const byte GuidClockSequenceByte = 8;
+ private const byte NodeByte = 10;
// offset to move from 1/1/0001, which is 0-time for .NET, to gregorian 0-time of 10/15/1582
private static readonly DateTime GregorianCalendarStart = new DateTime(1582, 10, 15, 0, 0, 0, DateTimeKind.Utc);
// random node that is 16 bytes
private static readonly byte[] RandomNode;
- private static Random _random = new Random();
-
static GuidGenerator()
{
RandomNode = new byte[6];
- _random.NextBytes(RandomNode);
+
+ var random = new Random();
+ random.NextBytes(RandomNode);
}
public static GuidVersion GetVersion(this Guid guid)
View
@@ -47,7 +47,7 @@ IEnumerator IEnumerable.GetEnumerator()
/// <returns></returns>
public IEnumerator<ICqlRow<CompareWith>> GetEnumerator()
{
- var result = CqlQueryEvaluator<CompareWith>.GetEvaluator<CompareWith>(Expression);
+ var result = CqlQueryEvaluator<CompareWith>.GetEvaluator(Expression);
return Provider.Cql(result.Query).GetEnumerator();
}
@@ -107,7 +107,7 @@ IQueryProvider IQueryable.Provider
/// <returns></returns>
public override string ToString()
{
- return CqlQueryEvaluator<CompareWith>.GetCql<CompareWith>(Expression);
+ return CqlQueryEvaluator<CompareWith>.GetCql(Expression);
}
}
}
@@ -50,8 +50,7 @@ private string Fields
private string WhereCriteria { get; set; }
- private void AddTable<CompareWith>(CassandraColumnFamily<CompareWith> provider)
- where CompareWith : CassandraType
+ private void AddTable(CassandraColumnFamily<CompareWith> provider)
{
_columnFamily = provider.FamilyName;
}
@@ -119,15 +118,13 @@ private static string GetPropertyName(Expression exp)
#region Expression Parsing
- public static string GetCql<CompareWith>(Expression expression)
- where CompareWith : CassandraType
+ public static string GetCql(Expression expression)
{
- var eval = GetEvaluator<CompareWith>(expression);
+ var eval = GetEvaluator(expression);
return eval.Query;
}
- public static CqlQueryEvaluator<CompareWith> GetEvaluator<CompareWith>(Expression expression)
- where CompareWith : CassandraType
+ public static CqlQueryEvaluator<CompareWith> GetEvaluator(Expression expression)
{
var eval = new CqlQueryEvaluator<CompareWith>();
eval.Evaluate(expression);
@@ -30,9 +30,6 @@ public override bool ConvertFrom(object value)
public override object ConvertTo(bool value, Type destinationType)
{
- if (!(value is bool))
- return null;
-
if (destinationType == typeof(byte[]))
return value.ToBytes();
@@ -67,7 +67,7 @@ public override List<CassandraType> ConvertFrom(object value)
public override object ConvertTo(List<CassandraType> value, Type destinationType)
{
if (destinationType == typeof(string))
- return String.Join(":", value);
+ return String.Join(":", (IEnumerable<CassandraType>)value);
if (destinationType == typeof(byte[]))
{
@@ -30,9 +30,6 @@ public override decimal ConvertFrom(object value)
public override object ConvertTo(decimal value, Type destinationType)
{
- if (!(value is decimal))
- return null;
-
if (destinationType == typeof(byte[]))
return value.ToBytes();
@@ -30,9 +30,6 @@ public override double ConvertFrom(object value)
public override object ConvertTo(double value, Type destinationType)
{
- if (!(value is double))
- return null;
-
if (destinationType == typeof(byte[]))
return value.ToBytes();
@@ -73,7 +73,7 @@ public override object ConvertTo(List<CassandraType> value, Type destinationType
return null;
if (destinationType == typeof(string))
- return String.Join(":", value);
+ return String.Join(":", (IEnumerable<CassandraType>)value);
if (destinationType == typeof(byte[]))
{
@@ -30,9 +30,6 @@ public override float ConvertFrom(object value)
public override object ConvertTo(float value, Type destinationType)
{
- if (!(value is float))
- return null;
-
if (destinationType == typeof(byte[]))
return value.ToBytes();
@@ -30,9 +30,6 @@ public override int ConvertFrom(object value)
public override object ConvertTo(int value, Type destinationType)
{
- if (!(value is int))
- return null;
-
if (destinationType == typeof(byte[]))
return value.ToBytes();
@@ -1,8 +1,7 @@
using System;
using System.Linq;
-using System.Linq;
-using NUnit.Framework;
using FluentCassandra.Types;
+using NUnit.Framework;
namespace FluentCassandra.TypesToDatabase
{
@@ -1,10 +1,8 @@
using System;
-using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.IO;
using System.Linq;
-using System.Linq;
using System.Reflection;
using System.Text;
using FluentCassandra.Types;

0 comments on commit 6d97c5d

Please sign in to comment.