Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 944354a

Browse files
committed
Copy missing SqlExpression fields when cloning
1 parent 7d105ae commit 944354a

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/ServiceStack.OrmLite/Expressions/SqlExpression.cs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ public abstract partial class SqlExpression<T> : ISqlExpression, IHasUntypedSqlE
4646
public List<IDbDataParameter> Params { get; set; }
4747
public Func<string,string> SqlFilter { get; set; }
4848
public static Action<SqlExpression<T>> SelectFilter { get; set; }
49+
public int? Rows { get; set; }
50+
public int? Offset { get; set; }
4951

5052
protected string Sep => sep;
5153

@@ -70,24 +72,30 @@ public SqlExpression<T> Clone()
7072

7173
protected virtual SqlExpression<T> CopyTo(SqlExpression<T> to)
7274
{
75+
to.visitedExpressionIsTableColumn = visitedExpressionIsTableColumn;
76+
to.skipParameterizationForThisExpression = skipParameterizationForThisExpression;
7377
to.underlyingExpression = underlyingExpression;
7478
to.orderByProperties = orderByProperties;
7579
to.selectExpression = selectExpression;
76-
to.selectDistinct = selectDistinct;
77-
to.CustomSelect = CustomSelect;
7880
to.fromExpression = fromExpression;
7981
to.whereExpression = whereExpression;
8082
to.groupBy = groupBy;
8183
to.havingExpression = havingExpression;
8284
to.orderBy = orderBy;
83-
to.OnlyFields = OnlyFields != null ? new HashSet<string>(OnlyFields) : null;
85+
to.OnlyFields = OnlyFields != null ? new HashSet<string>(OnlyFields, StringComparer.OrdinalIgnoreCase) : null;
8486
to.UpdateFields = UpdateFields;
8587
to.InsertFields = InsertFields;
88+
to.useFieldName = useFieldName;
89+
to.selectDistinct = selectDistinct;
90+
to.CustomSelect = CustomSelect;
8691
to.modelDef = modelDef;
8792
to.PrefixFieldWithTableName = PrefixFieldWithTableName;
8893
to.WhereStatementWithoutWhereString = WhereStatementWithoutWhereString;
8994
to.Params = new List<IDbDataParameter>(Params);
9095
to.SqlFilter = SqlFilter;
96+
to.Offset = Offset;
97+
to.Rows = Rows;
98+
to.tableDefs = tableDefs;
9199
return to;
92100
}
93101

@@ -1213,9 +1221,6 @@ public string OrderByExpression
12131221
}
12141222
}
12151223

1216-
public int? Rows { get; set; }
1217-
public int? Offset { get; set; }
1218-
12191224
public ModelDefinition ModelDef
12201225
{
12211226
get

0 commit comments

Comments
 (0)