public static string WhereExpression(this ExpressionType comparision, string assignmentName, object assignmentValue) { var queryComparison = comparision.ExpressionTypeToQueryComparison(); if (typeof(Guid?).IsInstanceOfType(assignmentValue)) { TableQuery.GenerateFilterConditionForGuid(assignmentName, queryComparison, (assignmentValue as Guid?).Value); } if (typeof(Guid).IsInstanceOfType(assignmentValue)) { return(TableQuery.GenerateFilterConditionForGuid(assignmentName, queryComparison, (Guid)assignmentValue)); } if (typeof(IReferenceable).IsInstanceOfType(assignmentValue)) { return(TableQuery.GenerateFilterConditionForGuid(assignmentName, queryComparison, ((IReferenceable)assignmentValue).id)); } if (typeof(bool).IsInstanceOfType(assignmentValue)) { return(TableQuery.GenerateFilterConditionForBool(assignmentName, queryComparison, (bool)assignmentValue)); } if (typeof(DateTime).IsInstanceOfType(assignmentValue)) { return(TableQuery.GenerateFilterConditionForDate(assignmentName, queryComparison, (DateTime)assignmentValue)); } if (typeof(int).IsInstanceOfType(assignmentValue)) { return(TableQuery.GenerateFilterConditionForInt(assignmentName, queryComparison, (int)assignmentValue)); } if (typeof(string).IsInstanceOfType(assignmentValue)) { return(TableQuery.GenerateFilterCondition(assignmentName, queryComparison, (string)assignmentValue)); } throw new NotImplementedException($"No filter condition created for type {assignmentValue.GetType().FullName}"); }