Skip to content

Commit fcfe638

Browse files
Thoriumsmoothdeveloper
authored andcommitted
minor code cleanup
1 parent 39033b4 commit fcfe638

File tree

8 files changed

+10
-11
lines changed

8 files changed

+10
-11
lines changed

src/SqlClient.DesignTime/DesignTime.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ type DesignTime private() =
610610
assert(p.Direction = ParameterDirection.Input)
611611

612612
let userDefinedTableTypeRow =
613-
if udttsPerSchema = null
613+
if isNull udttsPerSchema
614614
then //SqlCommandProvider case
615615
match cmdProvidedType.GetNestedType(p.TypeInfo.UdttName) with
616616
| null ->

src/SqlClient.DesignTime/DesignTimeConnectionString.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ type internal DesignTimeConnectionString =
6868
value
6969
else
7070
let section = ConfigurationManager.ConnectionStrings.[name]
71-
if section = null
71+
if isNull section
7272
then raise <| KeyNotFoundException(message = sprintf "Cannot find name %s in <connectionStrings> section of config file." name)
7373
else section.ConnectionString
7474
@@>

src/SqlClient.DesignTime/SqlClientProvider.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ type SqlProgrammabilityProvider(config : TypeProviderConfig) as this =
416416
Debug.Assert(values.Length = optionalParams.Length, "values.Length = optionalParams.Length")
417417

418418
for name, value, optional in Array.zip3 namesOfUpdateableColumns values optionalParams do
419-
row.[name] <- if value = null && optional then box DbNull else value
419+
row.[name] <- if isNull value && optional then box DbNull else value
420420
row
421421
@@>
422422

src/SqlClient.DesignTime/SqlCommandProvider.fs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ type SqlCommandProvider(config : TypeProviderConfig) as this =
111111

112112
let schemas =
113113
sqlDataTypes
114-
|> Seq.map (fun i -> i.RetrieveSchemas())
115-
|> Seq.concat
114+
|> Seq.collect (fun i -> i.RetrieveSchemas())
116115
|> Seq.distinct
117116
|> Seq.toArray
118117

src/SqlClient.DesignTime/SqlEnumProvider.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ type SqlEnumProvider(config : TypeProviderConfig) as this =
9494

9595
let getValueType(row: DataRow) =
9696
let t = Type.GetType( typeName = string row.["DataType"], throwOnError = true)
97-
if not( t.IsValueType || t = typeof<string>)
97+
if not( t.IsValueType || Type.(=)(t, typeof<string>))
9898
then
9999
failwithf "Invalid type %s of column %O for value part. Only .NET value types and strings supported as value." t.FullName row.["ColumnName"]
100100
t

src/SqlClient/DataTable.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ type DataTable<'T when 'T :> DataRow>(selectCommand: SqlCommand, ?connectionStri
3838

3939
member __.NewRow(): 'T = downcast base.NewRow()
4040

41-
member private this.IsDirectTable = this.TableName <> null
41+
member private this.IsDirectTable = not (isNull this.TableName)
4242

4343
member this.Update(?connection, ?transaction, ?batchSize, ?continueUpdateOnError, ?timeout: TimeSpan) =
4444
// not supported on all DataTable instances
@@ -49,7 +49,7 @@ type DataTable<'T when 'T :> DataRow>(selectCommand: SqlCommand, ?connectionStri
4949
connection |> Option.iter selectCommand.set_Connection
5050
transaction |> Option.iter selectCommand.set_Transaction
5151

52-
if selectCommand.Connection = null && this.IsDirectTable
52+
if isNull selectCommand.Connection && this.IsDirectTable
5353
then
5454
assert(connectionString.IsSome)
5555
selectCommand.Connection <- new SqlConnection( connectionString.Value.Value)

src/SqlClient/DynamicRecord.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ type DynamicRecord(data: IDictionary<string, obj>) =
1010
inherit DynamicObject()
1111

1212
do
13-
assert(data <> null)
13+
assert(not (isNull data))
1414

1515
member internal this.Data = data
1616

@@ -42,7 +42,7 @@ type DynamicRecord(data: IDictionary<string, obj>) =
4242
override this.ToString() =
4343
[|
4444
for KeyValue(key, value) in data ->
45-
sprintf "%s = %s" key ( if value = null || Convert.IsDBNull( value) then "None" else sprintf "%A" value)
45+
sprintf "%s = %s" key ( if isNull value || Convert.IsDBNull( value) then "None" else sprintf "%A" value)
4646
|]
4747
|> String.concat "; "
4848
|> sprintf "{ %s }"

src/SqlClient/ISqlCommand.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ type ``ISqlCommand Implementation``(cfg: DesignTimeConfig, connection: Connectio
107107
notImplemented,
108108
notImplemented
109109
| rowMapping, itemTypeName ->
110-
assert (rowMapping <> null && itemTypeName <> null)
110+
assert ((not(isNull rowMapping)) && (not (isNull itemTypeName)))
111111
let itemType = Type.GetType( itemTypeName, throwOnError = true)
112112

113113
let executeHandle =

0 commit comments

Comments
 (0)