@@ -25,14 +25,8 @@ public static class OrmLiteConfig
25
25
26
26
public static int CommandTimeout
27
27
{
28
- get
29
- {
30
- return commandTimeout ?? defaultCommandTimeout ;
31
- }
32
- set
33
- {
34
- commandTimeout = value ;
35
- }
28
+ get => commandTimeout ?? defaultCommandTimeout ;
29
+ set => commandTimeout = value ;
36
30
}
37
31
38
32
private static IOrmLiteDialectProvider dialectProvider ;
@@ -47,24 +41,19 @@ public static IOrmLiteDialectProvider DialectProvider
47
41
}
48
42
return dialectProvider ;
49
43
}
50
- set
51
- {
52
- dialectProvider = value ;
53
- }
44
+ set => dialectProvider = value ;
54
45
}
55
46
56
47
public static IOrmLiteDialectProvider GetDialectProvider ( this IDbCommand dbCmd )
57
48
{
58
- var ormLiteCmd = dbCmd as OrmLiteCommand ;
59
- return ormLiteCmd != null
49
+ return dbCmd is OrmLiteCommand ormLiteCmd
60
50
? ormLiteCmd . DialectProvider
61
51
: DialectProvider ;
62
52
}
63
53
64
54
public static IOrmLiteDialectProvider GetDialectProvider ( this IDbConnection db )
65
55
{
66
- var ormLiteConn = db as OrmLiteConnection ;
67
- return ormLiteConn != null
56
+ return db is OrmLiteConnection ormLiteConn
68
57
? ormLiteConn . DialectProvider
69
58
: DialectProvider ;
70
59
}
@@ -76,25 +65,22 @@ public static IOrmLiteExecFilter GetExecFilter(this IOrmLiteDialectProvider dial
76
65
}
77
66
78
67
public static IOrmLiteExecFilter GetExecFilter ( this IDbCommand dbCmd ) {
79
- var ormLiteCmd = dbCmd as OrmLiteCommand ;
80
- var dialectProvider = ormLiteCmd != null
68
+ var dialectProvider = dbCmd is OrmLiteCommand ormLiteCmd
81
69
? ormLiteCmd . DialectProvider
82
70
: DialectProvider ;
83
71
return dialectProvider . GetExecFilter ( ) ;
84
72
}
85
73
86
74
public static IOrmLiteExecFilter GetExecFilter ( this IDbConnection db ) {
87
- var ormLiteConn = db as OrmLiteConnection ;
88
- var dialectProvider = ormLiteConn != null
75
+ var dialectProvider = db is OrmLiteConnection ormLiteConn
89
76
? ormLiteConn . DialectProvider
90
77
: DialectProvider ;
91
78
return dialectProvider . GetExecFilter ( ) ;
92
79
}
93
80
94
81
public static void SetLastCommandText ( this IDbConnection db , string sql )
95
82
{
96
- var ormLiteConn = db as OrmLiteConnection ;
97
- if ( ormLiteConn != null )
83
+ if ( db is OrmLiteConnection ormLiteConn )
98
84
{
99
85
ormLiteConn . LastCommandText = sql ;
100
86
}
@@ -104,8 +90,7 @@ public static void SetLastCommandText(this IDbConnection db, string sql)
104
90
105
91
public static void SetCommandTimeout ( this IDbConnection db , int ? commandTimeout )
106
92
{
107
- var ormLiteConn = db as OrmLiteConnection ;
108
- if ( ormLiteConn == null )
93
+ if ( ! ( db is OrmLiteConnection ormLiteConn ) )
109
94
throw new NotImplementedException ( string . Format ( RequiresOrmLiteConnection , "CommandTimeout" ) ) ;
110
95
111
96
ormLiteConn . CommandTimeout = commandTimeout ;
@@ -167,7 +152,7 @@ public static IOrmLiteResultsFilter ResultsFilter
167
152
var state = OrmLiteContext . OrmLiteState ;
168
153
return state ? . ResultsFilter ;
169
154
}
170
- set { OrmLiteContext . GetOrCreateState ( ) . ResultsFilter = value ; }
155
+ set => OrmLiteContext . GetOrCreateState ( ) . ResultsFilter = value ;
171
156
}
172
157
173
158
private static IOrmLiteExecFilter execFilter ;
@@ -182,7 +167,7 @@ public static IOrmLiteExecFilter ExecFilter
182
167
? dialectProvider . ExecFilter ?? execFilter
183
168
: execFilter ;
184
169
}
185
- set { execFilter = value ; }
170
+ set => execFilter = value ;
186
171
}
187
172
188
173
public static Action < IDbCommand , object > InsertFilter { get ; set ; }
0 commit comments