@@ -216,22 +216,28 @@ public static MySqlDbType ConvertToMySqlDbType(ColumnDefinitionPayload columnDef
216216 var type = columnDefinition . ColumnType ;
217217 if ( columnDefinition . CharacterSet == CharacterSet . Binary )
218218 {
219- if ( ( guidFormat == MySqlGuidFormat . Binary16 || guidFormat == MySqlGuidFormat . TimeSwapBinary16 || guidFormat == MySqlGuidFormat . LittleEndianBinary16 ) && columnDefinition . ColumnLength == 16 )
219+ if ( ( guidFormat is MySqlGuidFormat . Binary16 or MySqlGuidFormat . TimeSwapBinary16 or MySqlGuidFormat . LittleEndianBinary16 ) && columnDefinition . ColumnLength == 16 )
220220 return MySqlDbType . Guid ;
221221
222- return type == ColumnType . String ? MySqlDbType . Binary :
223- type == ColumnType . VarString ? MySqlDbType . VarBinary :
224- type == ColumnType . TinyBlob ? MySqlDbType . TinyBlob :
225- type == ColumnType . Blob ? MySqlDbType . Blob :
226- type == ColumnType . MediumBlob ? MySqlDbType . MediumBlob :
227- MySqlDbType . LongBlob ;
222+ return type switch
223+ {
224+ ColumnType . String => MySqlDbType . Binary ,
225+ ColumnType . VarString => MySqlDbType . VarBinary ,
226+ ColumnType . TinyBlob => MySqlDbType . TinyBlob ,
227+ ColumnType . Blob => MySqlDbType . Blob ,
228+ ColumnType . MediumBlob => MySqlDbType . MediumBlob ,
229+ _ => MySqlDbType . LongBlob ,
230+ } ;
228231 }
229- return type == ColumnType . String ? MySqlDbType . String :
230- type == ColumnType . VarString ? MySqlDbType . VarChar :
231- type == ColumnType . TinyBlob ? MySqlDbType . TinyText :
232- type == ColumnType . Blob ? MySqlDbType . Text :
233- type == ColumnType . MediumBlob ? MySqlDbType . MediumText :
234- MySqlDbType . LongText ;
232+ return type switch
233+ {
234+ ColumnType . String => MySqlDbType . String ,
235+ ColumnType . VarString => MySqlDbType . VarChar ,
236+ ColumnType . TinyBlob => MySqlDbType . TinyText ,
237+ ColumnType . Blob => MySqlDbType . Text ,
238+ ColumnType . MediumBlob => MySqlDbType . MediumText ,
239+ _ => MySqlDbType . LongText ,
240+ } ;
235241
236242 case ColumnType . Json :
237243 return MySqlDbType . JSON ;
@@ -285,8 +291,7 @@ public static MySqlDbType ConvertToMySqlDbType(ColumnDefinitionPayload columnDef
285291
286292 public static ushort ConvertToColumnTypeAndFlags ( MySqlDbType dbType , MySqlGuidFormat guidFormat )
287293 {
288- var isUnsigned = dbType == MySqlDbType . UByte || dbType == MySqlDbType . UInt16 ||
289- dbType == MySqlDbType . UInt24 || dbType == MySqlDbType . UInt32 || dbType == MySqlDbType . UInt64 ;
294+ var isUnsigned = dbType is MySqlDbType . UByte or MySqlDbType . UInt16 or MySqlDbType . UInt24 or MySqlDbType . UInt32 or MySqlDbType . UInt64 ;
290295 var columnType = dbType switch
291296 {
292297 MySqlDbType . Bool or MySqlDbType . Byte or MySqlDbType . UByte => ColumnType . Tiny ,
@@ -295,7 +300,7 @@ public static ushort ConvertToColumnTypeAndFlags(MySqlDbType dbType, MySqlGuidFo
295300 MySqlDbType . Int32 or MySqlDbType . UInt32 => ColumnType . Long ,
296301 MySqlDbType . Int64 or MySqlDbType . UInt64 => ColumnType . Longlong ,
297302 MySqlDbType . Bit => ColumnType . Bit ,
298- MySqlDbType . Guid => ( guidFormat == MySqlGuidFormat . Char36 || guidFormat == MySqlGuidFormat . Char32 ) ? ColumnType . String : ColumnType . Blob ,
303+ MySqlDbType . Guid => ( guidFormat is MySqlGuidFormat . Char36 or MySqlGuidFormat . Char32 ) ? ColumnType . String : ColumnType . Blob ,
299304 MySqlDbType . Enum or MySqlDbType . Set => ColumnType . String ,
300305 MySqlDbType . Binary or MySqlDbType . String => ColumnType . String ,
301306 MySqlDbType . VarBinary or MySqlDbType . VarChar or MySqlDbType . VarString => ColumnType . VarString ,
0 commit comments