Skip to content

Commit 36d78ed

Browse files
committed
#27 cleaned out unfreferenced code
1 parent a309da4 commit 36d78ed

File tree

3 files changed

+0
-208
lines changed

3 files changed

+0
-208
lines changed

SubSonic/Infrastructure/Builders/DbSqlQueryBuilder/DbSqlQueryBuilderBuildMethods.cs

Lines changed: 0 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,6 @@ public partial class DbSqlQueryBuilder
2323
#endregion
2424

2525
#region Build Select
26-
public Expression BuildSelect(System.Linq.IQueryable queryable)
27-
{
28-
if (queryable.IsNull())
29-
{
30-
throw new ArgumentNullException(nameof(queryable));
31-
}
32-
33-
return DbExpression.DbSelect(queryable, queryable.Expression.Type, DbTable);
34-
}
35-
36-
public Expression BuildSelect(System.Linq.IQueryable queryable, Expression where)
37-
{
38-
if (queryable.IsNull())
39-
{
40-
throw new ArgumentNullException(nameof(queryable));
41-
}
42-
43-
return new DbSelectExpression(queryable, queryable.Expression.Type, DbTable, DbTable.Columns, where);
44-
}
45-
4626
public Expression BuildSelect(Expression select, Expression where)
4727
{
4828
if (select is DbSelectExpression _select)
@@ -63,15 +43,6 @@ public Expression BuildSelect(Expression expression, bool isDistinct)
6343
throw new NotSupportedException();
6444
}
6545

66-
public Expression BuildSelect(Expression expression, int count)
67-
{
68-
if (expression is DbSelectExpression select)
69-
{
70-
return new DbSelectExpression(select.QueryObject, select.Type, select.From, select.Columns, select.Where, select.OrderBy, select.GroupBy, select.IsDistinct, Expression.Constant(count), select.Skip);
71-
}
72-
73-
throw new NotSupportedException();
74-
}
7546
public Expression BuildSelect(Expression expression, int pageNumber, int pageSize)
7647
{
7748
if (expression is DbSelectExpression select)
@@ -106,34 +77,6 @@ public Expression BuildSelect(Expression expression, IDbEntityProperty property)
10677
throw new NotSupportedException();
10778
}
10879

109-
public Expression BuildSelect(Expression expression, IEnumerable<DbOrderByDeclaration> orderBy)
110-
{
111-
if (expression is DbSelectExpression select)
112-
{
113-
return new DbSelectExpression(select.QueryObject, select.Type, select.From, select.Columns, select.Where, orderBy, select.GroupBy, select.IsDistinct, select.Take, select.Skip);
114-
}
115-
116-
throw new NotSupportedException();
117-
}
118-
public Expression BuildSelect(Expression expression, IEnumerable<Expression> groupBy)
119-
{
120-
if (expression is DbSelectExpression select)
121-
{
122-
return new DbSelectExpression(select.QueryObject, select.Type, select.From, select.Columns, select.Where, select.OrderBy, groupBy, select.IsDistinct, select.Take, select.Skip);
123-
}
124-
125-
throw new NotSupportedException();
126-
}
127-
128-
public Expression BuildSelect(Expression select, DbExpressionType eType, IEnumerable<Expression> expressions)
129-
{
130-
if (select is DbSelectExpression)
131-
{
132-
throw new NotImplementedException();
133-
}
134-
return select;
135-
}
136-
13780
private Expression BuildSelect(Expression expression, IEnumerable<DbColumnDeclaration> columns)
13881
{
13982
if (expression is DbSelectExpression select)
@@ -164,51 +107,6 @@ public Expression BuildWhere(DbExpression expression, LambdaExpression predicate
164107
DbExpression.DbWhere(method, new Expression[] { expression, predicate }));
165108
}
166109

167-
public Expression BuildWhere(DbTableExpression table, Expression where, Type type, LambdaExpression predicate)
168-
{
169-
if (where.IsNotNull())
170-
{
171-
if (predicate is null)
172-
{
173-
throw new ArgumentNullException(nameof(predicate));
174-
}
175-
176-
if (((DbExpressionType)where.NodeType) == DbExpressionType.Where &&
177-
where is DbWhereExpression _where)
178-
{
179-
Expression
180-
logical = DbWherePredicateBuilder.GetBodyExpression(_where.GetArgument(1), predicate.Body, DbGroupOperator.AndAlso);
181-
predicate = BuildLambda(logical, LambdaType.Predicate) as LambdaExpression;
182-
}
183-
else
184-
{
185-
throw new NotSupportedException();
186-
}
187-
}
188-
189-
throw Error.NotImplemented();
190-
}
191-
192-
//public Expression BuildWhere(DbTableExpression table, Expression where, Type type, Expression predicate)
193-
//{
194-
// LambdaExpression lambda = null;
195-
196-
// if (predicate is UnaryExpression unary)
197-
// {
198-
// if (unary.Operand is LambdaExpression _unary)
199-
// {
200-
// lambda = _unary;
201-
// }
202-
// }
203-
204-
// return BuildWhere(table, where, type, lambda);
205-
//}
206-
207-
public Expression BuildWherePredicate(Expression collection, Expression lambda)
208-
{
209-
return BuildCall("Where", collection, lambda);
210-
}
211-
212110
public Expression BuildWhereFindByIDPredicate(DbExpression expression, object[] keyData, params string[] keyNames)
213111
{
214112
if (keyData.IsNull())
@@ -246,24 +144,8 @@ public Expression BuildJoin(JoinType type, Expression left, Expression right)
246144
#endregion
247145

248146
#region Lambda
249-
public Expression BuildCall(string nameofCallee, Expression collection, Expression lambda)
250-
{
251-
if (lambda.IsNotNull())
252-
{
253-
return Expression.Call(
254-
typeof(System.Linq.Queryable),
255-
nameofCallee,
256-
GetTypeArguments((LambdaExpression)lambda),
257-
GetMethodCall(collection) ?? Expression.Parameter(GetTypeOf(typeof(ISubSonicCollection<>), DbEntity.EntityModelType)),
258-
lambda);
259-
}
260-
return lambda;
261-
}
262-
263147
public Expression BuildLambda(Expression body, LambdaType @call, params string[] properties)
264148
{
265-
Expression result;
266-
267149
switch (call)
268150
{
269151
case Infrastructure.LambdaType.Predicate:
@@ -538,27 +420,6 @@ protected virtual Expression BuildQuery(Expression expression)
538420
return expression ?? DbEntity.Table;
539421
}
540422

541-
private Type GetTypeOf(Type type, params Type[] types)
542-
{
543-
return type.IsGenericType ? type.MakeGenericType(types) : type;
544-
}
545-
546-
private static Type[] GetTypeArguments(LambdaExpression expression)
547-
{
548-
if (expression.IsNotNull())
549-
{
550-
IEnumerable<Type> types = expression.Parameters.Select(Param => Param.Type);
551-
552-
if (!expression.Body.Type.IsBoolean())
553-
{ // not a predicate
554-
types = types.Union(new[] { expression.Body.Type });
555-
}
556-
557-
return types.ToArray();
558-
}
559-
return Array.Empty<Type>();
560-
}
561-
562423
private Expression BuildSelectWithExpression(MethodCallExpression expression)
563424
{
564425
if (!(expression is null))

SubSonic/Infrastructure/Builders/DbSqlTableTypeProvider.cs

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ public DbSqlTableTypeProvider(string tableTypeName, Type elementType, ISubSonicL
3636

3737
public DbTableExpression DbTable { get; }
3838

39-
public Expression BuildCall(string nameOfCallee, Expression collection, Expression lambda)
40-
{
41-
throw new NotImplementedException();
42-
}
43-
4439
public Expression BuildJoin(JoinType type, Expression left, Expression right)
4540
{
4641
throw new NotImplementedException();
@@ -66,16 +61,6 @@ public Expression BuildLogicalIn(Expression body, PropertyInfo property, IEnumer
6661
throw new NotImplementedException();
6762
}
6863

69-
public Expression BuildSelect(IQueryable queryable)
70-
{
71-
throw new NotImplementedException();
72-
}
73-
74-
public Expression BuildSelect(IQueryable queryable, Expression eWhere)
75-
{
76-
throw new NotImplementedException();
77-
}
78-
7964
public Expression BuildSelect(Expression eSelect, Expression eWhere)
8065
{
8166
throw new NotImplementedException();
@@ -86,11 +71,6 @@ public Expression BuildSelect(Expression eSelect, bool isDistinct)
8671
throw new NotImplementedException();
8772
}
8873

89-
public Expression BuildSelect(Expression eSelect, int count)
90-
{
91-
throw new NotImplementedException();
92-
}
93-
9474
public Expression BuildSelect(Expression eSelect, int pageNumber, int pageSize)
9575
{
9676
throw new NotImplementedException();
@@ -116,46 +96,6 @@ public Expression BuildSelect(Expression expression, IDbEntityProperty property)
11696
throw new NotSupportedException();
11797
}
11898

119-
public Expression BuildSelect(Expression eSelect, IEnumerable<DbOrderByDeclaration> orderBy)
120-
{
121-
throw new NotImplementedException();
122-
}
123-
124-
public Expression BuildSelect(Expression eSelect, IEnumerable<Expression> groupBy)
125-
{
126-
throw new NotImplementedException();
127-
}
128-
129-
public Expression BuildSelect(Expression eSelect, DbExpressionType eType, IEnumerable<Expression> expressions)
130-
{
131-
throw new NotImplementedException();
132-
}
133-
134-
public Expression BuildSelect<TEntity, TColumn>(Expression eSelect, Expression<Func<TEntity, TColumn>> selector)
135-
{
136-
throw new NotImplementedException();
137-
}
138-
139-
public Expression BuildWhere(DbTableExpression table, Expression where, Type type, LambdaExpression predicate)
140-
{
141-
throw new NotImplementedException();
142-
}
143-
144-
public Expression BuildWhereExists<TEntity>(DbTableExpression dbTableExpression, Type type, Expression<Func<TEntity, IQueryable>> query)
145-
{
146-
throw new NotImplementedException();
147-
}
148-
149-
public Expression BuildWhereNotExists<TEntity>(DbTableExpression from, Type type, Expression<Func<TEntity, IQueryable>> query)
150-
{
151-
throw new NotImplementedException();
152-
}
153-
154-
public Expression BuildWherePredicate(Expression collection, Expression logical)
155-
{
156-
throw new NotImplementedException();
157-
}
158-
15999
public Expression BuildWhereFindByIDPredicate(DbExpression expression, object[] keyData, params string[] keyNames)
160100
{
161101
throw new NotImplementedException();

SubSonic/Interfaces/Builders/IDbSqlQueryBuilder.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ public interface ISubSonicQueryProvider
1717
Expression BuildLogicalIn(Expression body, PropertyInfo property, IQueryable queryable, DbGroupOperator @group);
1818
Expression BuildLogicalIn(Expression body, PropertyInfo property, IEnumerable<Expression> values, DbGroupOperator @group);
1919
Expression BuildLogicalBinary(Expression eBody, string name, object value, DbComparisonOperator op, DbGroupOperator group);
20-
Expression BuildWherePredicate(Expression collection, Expression logical);
2120
/// <summary>
2221
///
2322
/// </summary>
@@ -26,20 +25,12 @@ public interface ISubSonicQueryProvider
2625
/// <param name="keyNames"></param>
2726
/// <returns></returns>
2827
Expression BuildWhereFindByIDPredicate(DbExpression expression, object[] keyData, params string[] keyNames);
29-
Expression BuildSelect(IQueryable queryable);
30-
Expression BuildSelect(IQueryable queryable, Expression eWhere);
3128
Expression BuildSelect(Expression eSelect, Expression eWhere);
3229
Expression BuildSelect(Expression eSelect, bool isDistinct);
33-
Expression BuildSelect(Expression eSelect, int count);
3430
Expression BuildSelect(Expression eSelect, int pageNumber, int pageSize);
3531
Expression BuildSelect(Expression eSelect, IDbEntityProperty properties);
36-
Expression BuildSelect(Expression eSelect, IEnumerable<DbOrderByDeclaration> orderBy);
37-
Expression BuildSelect(Expression eSelect, IEnumerable<Expression> groupBy);
38-
Expression BuildSelect(Expression eSelect, DbExpressionType eType, IEnumerable<Expression> expressions);
39-
Expression BuildWhere(DbTableExpression table, Expression where, Type type, LambdaExpression predicate);
4032
Expression BuildJoin(JoinType type, Expression left, Expression right);
4133
Expression BuildLambda(Expression body, LambdaType callType, params string[] properties);
42-
Expression BuildCall(string nameOfCallee, Expression collection, Expression lambda);
4334

4435
IDbQuery BuildDbQuery<TEntity>(DbQueryType queryType, IEnumerable<IEntityProxy> proxies);
4536
IDbQuery ToQuery(Expression expression);

0 commit comments

Comments
 (0)