Skip to content

Commit 357204a

Browse files
committed
minor cleanup
1 parent 9e659bd commit 357204a

File tree

2 files changed

+1
-31
lines changed

2 files changed

+1
-31
lines changed

src/SQLProvider.Common/SqlRuntime.Linq.fs

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -713,9 +713,6 @@ module internal QueryImplementation =
713713
if isHaving then HavingClause(filter,current)
714714
else FilterClause(filter,current)
715715

716-
//let ty = typedefof<SqlQueryable<_>>.MakeGenericType(meth.GetGenericArguments().[0])
717-
//ty.GetConstructors().[0].Invoke [| source.DataContext; source.Provider; sqlExpression; source.TupleIndex; |] :?> IQueryable<_>
718-
719716
let ty = typeof<SqlQueryable<'T>>
720717
Activator.CreateInstance(ty, [| source.DataContext |> box; source.Provider; sqlExpression; source.TupleIndex |]) :?> IQueryable<'T>
721718

@@ -930,14 +927,10 @@ module internal QueryImplementation =
930927
Common.QueryEvents.PublishExpression e
931928
match e with
932929
| MethodCall(None, (MethodWithName "Skip" as meth), [SourceWithQueryData source; Int amount]) ->
933-
//let ty = typedefof<SqlQueryable<_>>.MakeGenericType(meth.GetGenericArguments().[0])
934-
//ty.GetConstructors().[0].Invoke [| source.DataContext ; source.Provider; Skip(amount,source.SqlExpression) ; source.TupleIndex; |] :?> IQueryable<_>
935930
let ty = typeof<SqlQueryable<'T>>
936931
Activator.CreateInstance(ty, [| source.DataContext |> box; source.Provider; Skip(amount,source.SqlExpression); source.TupleIndex |]) :?> IQueryable<_>
937932

938933
| MethodCall(None, (MethodWithName "Take" as meth), [SourceWithQueryData source; Int amount]) ->
939-
//let ty = typedefof<SqlQueryable<_>>.MakeGenericType(meth.GetGenericArguments().[0])
940-
//ty.GetConstructors().[0].Invoke [| source.DataContext ; source.Provider; Take(amount,source.SqlExpression) ; source.TupleIndex; |] :?> IQueryable<_>
941934
let ty = typeof<SqlQueryable<'T>>
942935
Activator.CreateInstance(ty, [| source.DataContext |> box; source.Provider; Take(amount,source.SqlExpression); source.TupleIndex |]) :?> IQueryable<'T>
943936

@@ -956,9 +949,6 @@ module internal QueryImplementation =
956949
gbv |> snd |> List.fold(fun exprstate (al,itm) ->
957950
OrderBy(al,itm,ascending,exprstate)) source.SqlExpression
958951
| _ -> OrderBy(alias,key,ascending,source.SqlExpression)
959-
//let ty = typedefof<SqlOrderedQueryable<_>>.MakeGenericType(meth.GetGenericArguments().[0])
960-
//let x = ty.GetConstructors().[0].Invoke [| source.DataContext ; source.Provider; sqlExpression; source.TupleIndex; |]
961-
//x :?> IQueryable<_>
962952
let ty = typeof<SqlOrderedQueryable<'T>>
963953
Activator.CreateInstance(ty, [| source.DataContext |> box; source.Provider; sqlExpression; source.TupleIndex |]) :?> IQueryable<'T>
964954

@@ -982,8 +972,6 @@ module internal QueryImplementation =
982972
| _ -> OrderBy(alias,key,ascending,source.SqlExpression)
983973

984974
Activator.CreateInstance(ty, [| source.DataContext |> box; source.Provider; sqlExpression; source.TupleIndex |]) :?> IQueryable<'T>
985-
//let x = ty.GetConstructors().[0].Invoke [| source.DataContext; source.Provider; sqlExpression ; source.TupleIndex; |]
986-
//x :?> IQueryable<_>
987975
| _ when source.SqlExpression.hasSortBy() -> failwith (sprintf "'thenBy' operations must come immediately after a 'sortBy' operation in a query")
988976
| _ -> // Then by alone works as OrderBy
989977
let sqlExpression =
@@ -994,18 +982,12 @@ module internal QueryImplementation =
994982
OrderBy(al,itm,ascending,exprstate)) source.SqlExpression
995983
| _ -> OrderBy(alias,key,ascending,source.SqlExpression)
996984
Activator.CreateInstance(ty, [| source.DataContext |> box; source.Provider; sqlExpression; source.TupleIndex |]) :?> IQueryable<'T>
997-
//let x = ty.GetConstructors().[0].Invoke [| source.DataContext ; source.Provider; sqlExpression; source.TupleIndex; |]
998-
//x :?> IQueryable<_>
999985
| MethodCall(None, (MethodWithName "OrderBy" | MethodWithName "OrderByDescending" as meth), [SourceWithQueryData source; OptionalQuote (Lambda([ParamName param], OptionalConvertOrTypeAs (Constant(v,t))))])
1000986
| MethodCall(None, (MethodWithName "ThenBy" | MethodWithName "ThenByDescending" as meth), [SourceWithQueryData source; OptionalQuote (Lambda([ParamName param], OptionalConvertOrTypeAs (Constant(v,t)))) ]) ->
1001-
//let ty = typedefof<SqlOrderedQueryable<_>>.MakeGenericType(meth.GetGenericArguments().[0]) // Sort by constant can be ignored, except it changes the return type
1002-
//ty.GetConstructors().[0].Invoke [| source.DataContext ; source.Provider; source.SqlExpression ; source.TupleIndex; |] :?> IQueryable<_>
1003987
let ty = typeof<SqlOrderedQueryable<'T>>
1004988
Activator.CreateInstance(ty, [| source.DataContext |> box; source.Provider; source.SqlExpression; source.TupleIndex |]) :?> IQueryable<'T>
1005989

1006990
| MethodCall(None, (MethodWithName "Distinct" as meth), [ SourceWithQueryData source ]) ->
1007-
//let ty = typedefof<SqlQueryable<_>>.MakeGenericType(meth.GetGenericArguments().[0])
1008-
//ty.GetConstructors().[0].Invoke [| source.DataContext; source.Provider; Distinct(source.SqlExpression) ; source.TupleIndex; |] :?> IQueryable<_>
1009991
let ty = typeof<SqlOrderedQueryable<'T>>
1010992
Activator.CreateInstance(ty, [| source.DataContext |> box; source.Provider; Distinct(source.SqlExpression); source.TupleIndex |]) :?> IQueryable<'T>
1011993

@@ -1076,11 +1058,6 @@ module internal QueryImplementation =
10761058
OuterJoin = isOuter; RelDirection = RelationshipDirection.Parents }
10771059
SelectMany(sourceAlias,destAlias,LinkQuery(data),source.SqlExpression)
10781060

1079-
//let ty =
1080-
// match projection with
1081-
// | :? LambdaExpression as meth -> typedefof<SqlQueryable<_>>.MakeGenericType(meth.ReturnType)
1082-
// | _ -> failwith "unsupported projection in join"
1083-
//ty.GetConstructors().[0].Invoke [| source.DataContext; source.Provider; sqlExpression; source.TupleIndex; |] :?> IQueryable<_>
10841061
let ty = typeof<SqlQueryable<'T>>
10851062
Activator.CreateInstance(ty, [| source.DataContext |> box; source.Provider; sqlExpression; source.TupleIndex |]) :?> IQueryable<'T>
10861063

@@ -1117,11 +1094,6 @@ module internal QueryImplementation =
11171094
OuterJoin = isOuter; RelDirection = RelationshipDirection.Parents }
11181095
SelectMany(sourceAlias,destAlias,LinkQuery(data),source.SqlExpression)
11191096

1120-
//let ty =
1121-
// match projection with
1122-
// | :? LambdaExpression as meth -> typedefof<SqlQueryable<_>>.MakeGenericType(meth.ReturnType)
1123-
// | _ -> failwithf "unsupported projection in join (%O)" projection
1124-
//ty.GetConstructors().[0].Invoke [| source.DataContext; source.Provider; sqlExpression; source.TupleIndex; |] :?> IQueryable<_>
11251097

11261098
let ty = typeof<SqlQueryable<'T>>
11271099
Activator.CreateInstance(ty, [| source.DataContext |> box; source.Provider; sqlExpression; source.TupleIndex |]) :?> IQueryable<'T>
@@ -1138,7 +1110,6 @@ module internal QueryImplementation =
11381110
let ex = processSelectManys projectionParams.[1].Name inner source.SqlExpression projectionParams source
11391111
let ty = typeof<SqlQueryable<'T>>
11401112
Activator.CreateInstance(ty, [| source.DataContext |> box; source.Provider; ex; source.TupleIndex |]) :?> IQueryable<'T>
1141-
//ty.GetConstructors().[0].Invoke [| source.DataContext; source.Provider; ex; source.TupleIndex;|] :?> IQueryable<_>
11421113

11431114
| MethodCall(None, (MethodWithName "Select"), [ SourceWithQueryData source; OptionalQuote (Lambda([ v1 ], _) as lambda) ]) as whole ->
11441115
let ty = typedefof<SqlQueryable<_>>.MakeGenericType((lambda :?> LambdaExpression).ReturnType )
@@ -1180,7 +1151,6 @@ module internal QueryImplementation =
11801151
| _ -> failwithf "Unsupported union type: %s" meth.Name
11811152

11821153

1183-
//ty.GetConstructors().[0].Invoke [| source.DataContext; source.Provider; Union(utyp,subquery,modified,source.SqlExpression) ; source.TupleIndex; |] :?> IQueryable<_>
11841154
let ty = typeof<SqlQueryable<'T>>
11851155
Activator.CreateInstance(ty, [| source.DataContext |> box; source.Provider; Union(utyp,subquery,modified,source.SqlExpression); source.TupleIndex |]) :?> IQueryable<'T>
11861156

src/SQLProvider.DesignTime/SqlDesignTime.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ module DesignTimeUtils =
583583
with
584584
| exn ->
585585
let baseError = exn.GetBaseException()
586-
failwithf $"Error opening compile-time connection. Connection string: {conString}. Error: {typeof<exn>}, {exn.Message}, inner {baseError.GetType()} {baseError.Message}"
586+
failwithf $"Error opening compile-time connection. Connection string: {conString}. Error: {exn.GetType()}, {exn.Message}, inner {baseError.GetType()} {baseError.Message}"
587587
prov.CreateTypeMappings con
588588
Some con
589589
| true ->

0 commit comments

Comments
 (0)