Skip to content

Commit cef0f2e

Browse files
committed
Switch to file-scoped namespaces.
1 parent 4ac1ef8 commit cef0f2e

File tree

205 files changed

+7084
-7281
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

205 files changed

+7084
-7281
lines changed

src/AdoNet.Databases/AdoNet.Databases.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
5+
<LangVersion>10.0</LangVersion>
56
</PropertyGroup>
67

78
<ItemGroup>

src/AdoNet.Databases/MySqlDatabase.cs

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
using System.Data;
55
using AdoNet.Specification.Tests;
66

7-
namespace AdoNet.Databases
7+
namespace AdoNet.Databases;
8+
9+
public static class MySqlDatabase
810
{
9-
public static class MySqlDatabase
11+
public static void CreateSelectValueTable(IDbFactoryFixture factoryFixture)
1012
{
11-
public static void CreateSelectValueTable(IDbFactoryFixture factoryFixture)
12-
{
13-
Utility.ExecuteNonQuery(factoryFixture, @"drop table if exists select_value;
13+
Utility.ExecuteNonQuery(factoryFixture, @"drop table if exists select_value;
1414
create table select_value
1515
(
1616
Id int not null primary key,
@@ -41,40 +41,39 @@ insert into select_value values
4141
(4, null, false, 0, -128, -32768, 0, -2147483648, 0, -9223372036854775808, 0, 1.18e-38, 2.23e-308, 0.000000000000001, null, '33221100-5544-7766-9988-aabbccddeeff', '1000-01-01', '1000-01-01 00:00:00', '-838:59:59'),
4242
(5, null, true, 255, 127, 32767, 65535, 2147483647, 4294967295, 9223372036854775807, 18446744073709551615, 3.40e38, 1.79e308, 99999999999999999999.999999999999999, null, 'ccddeeff-aabb-8899-7766-554433221100', '9999-12-31', '9999-12-31 23:59:59.999', '838:59:59');
4343
");
44-
}
44+
}
4545

46-
public static void DropSelectValueTable(IDbFactoryFixture factoryFixture) => Utility.ExecuteNonQuery(factoryFixture, "drop table if exists select_value;");
46+
public static void DropSelectValueTable(IDbFactoryFixture factoryFixture) => Utility.ExecuteNonQuery(factoryFixture, "drop table if exists select_value;");
4747

48-
public static string CreateSelectSql(DbType dbType, ValueKind kind) => $"SELECT `{dbType.ToString()}` from select_value WHERE Id = {(int) kind};";
48+
public static string CreateSelectSql(DbType dbType, ValueKind kind) => $"SELECT `{dbType.ToString()}` from select_value WHERE Id = {(int) kind};";
4949

50-
public static string CreateSelectSql(byte[] value) => $"SELECT X'{BitConverter.ToString(value).Replace("-", "")}'";
50+
public static string CreateSelectSql(byte[] value) => $"SELECT X'{BitConverter.ToString(value).Replace("-", "")}'";
5151

52-
public static string SelectNoRows => "SELECT * FROM mysql.user WHERE 0 = 1;";
52+
public static string SelectNoRows => "SELECT * FROM mysql.user WHERE 0 = 1;";
5353

54-
public static string DeleteNoRows => "DELETE FROM select_value WHERE 0 = 1;";
54+
public static string DeleteNoRows => "DELETE FROM select_value WHERE 0 = 1;";
5555

56-
public static IReadOnlyCollection<DbType> SupportedDbTypes { get; } = new ReadOnlyCollection<DbType>(new[]
57-
{
58-
DbType.Binary,
59-
DbType.Boolean,
60-
DbType.Byte,
61-
DbType.Date,
62-
DbType.DateTime,
63-
DbType.Decimal,
64-
DbType.Double,
65-
DbType.Guid,
66-
DbType.Int16,
67-
DbType.Int32,
68-
DbType.Int64,
69-
DbType.SByte,
70-
DbType.Single,
71-
DbType.String,
72-
DbType.Time,
73-
DbType.UInt16,
74-
DbType.UInt32,
75-
DbType.UInt64,
76-
});
56+
public static IReadOnlyCollection<DbType> SupportedDbTypes { get; } = new ReadOnlyCollection<DbType>(new[]
57+
{
58+
DbType.Binary,
59+
DbType.Boolean,
60+
DbType.Byte,
61+
DbType.Date,
62+
DbType.DateTime,
63+
DbType.Decimal,
64+
DbType.Double,
65+
DbType.Guid,
66+
DbType.Int16,
67+
DbType.Int32,
68+
DbType.Int64,
69+
DbType.SByte,
70+
DbType.Single,
71+
DbType.String,
72+
DbType.Time,
73+
DbType.UInt16,
74+
DbType.UInt32,
75+
DbType.UInt64,
76+
});
7777

78-
public static Type NullValueExceptionType => typeof(InvalidCastException);
79-
}
78+
public static Type NullValueExceptionType => typeof(InvalidCastException);
8079
}

src/AdoNet.Databases/PostgreSqlDatabase.cs

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
using System.Linq;
66
using AdoNet.Specification.Tests;
77

8-
namespace AdoNet.Databases
8+
namespace AdoNet.Databases;
9+
10+
public static class PostgreSqlDatabase
911
{
10-
public static class PostgreSqlDatabase
12+
public static void CreateSelectValueTable(IDbFactoryFixture factoryFixture)
1113
{
12-
public static void CreateSelectValueTable(IDbFactoryFixture factoryFixture)
13-
{
14-
Utility.ExecuteNonQuery(factoryFixture, @"drop table if exists select_value;
14+
Utility.ExecuteNonQuery(factoryFixture, @"drop table if exists select_value;
1515
create table select_value
1616
(
1717
Id integer not null primary key,
@@ -38,36 +38,35 @@ insert into select_value values
3838
(4, null, false, '0001-01-01', '0001-01-01', '0001-01-01', 0.000000000000001, 2.23e-308, '33221100-5544-7766-9988-aabbccddeeff', -32768, -2147483648, -9223372036854775808, 1.18e-38, null, '00:00:00'),
3939
(5, null, true, '9999-12-31', '9999-12-31 23:59:59.999', '9999-12-31 23:59:59.999 +14:00', 99999999999999999999.999999999999999, 1.79e308, 'ccddeeff-aabb-8899-7766-554433221100', 32767, 2147483647, 9223372036854775807, 3.40e38, null, '23:59:59.999');
4040
");
41-
}
41+
}
4242

43-
public static void DropSelectValueTable(IDbFactoryFixture factoryFixture) => Utility.ExecuteNonQuery(factoryFixture, "drop table if exists select_value;");
43+
public static void DropSelectValueTable(IDbFactoryFixture factoryFixture) => Utility.ExecuteNonQuery(factoryFixture, "drop table if exists select_value;");
4444

45-
public static string CreateSelectSql(DbType dbType, ValueKind kind) => $"SELECT \"{dbType.ToString()}\" from select_value WHERE Id = {(int) kind};";
45+
public static string CreateSelectSql(DbType dbType, ValueKind kind) => $"SELECT \"{dbType.ToString()}\" from select_value WHERE Id = {(int) kind};";
4646

47-
public static string CreateSelectSql(byte[] value) => $@"SELECT E'{string.Join("", value.Select(x => @"\x" + x.ToString("X2")))}'::bytea";
47+
public static string CreateSelectSql(byte[] value) => $@"SELECT E'{string.Join("", value.Select(x => @"\x" + x.ToString("X2")))}'::bytea";
4848

49-
public static string SelectNoRows => "SELECT 1 WHERE 0 = 1;";
49+
public static string SelectNoRows => "SELECT 1 WHERE 0 = 1;";
5050

51-
public static string DeleteNoRows => "DELETE FROM select_value WHERE 0 = 1;";
51+
public static string DeleteNoRows => "DELETE FROM select_value WHERE 0 = 1;";
5252

53-
public static IReadOnlyCollection<DbType> SupportedDbTypes { get; } = new ReadOnlyCollection<DbType>(new[]
54-
{
55-
DbType.Binary,
56-
DbType.Boolean,
57-
DbType.Date,
58-
DbType.DateTime,
59-
DbType.DateTimeOffset,
60-
DbType.Decimal,
61-
DbType.Double,
62-
DbType.Guid,
63-
DbType.Int16,
64-
DbType.Int32,
65-
DbType.Int64,
66-
DbType.Single,
67-
DbType.String,
68-
DbType.Time,
69-
});
53+
public static IReadOnlyCollection<DbType> SupportedDbTypes { get; } = new ReadOnlyCollection<DbType>(new[]
54+
{
55+
DbType.Binary,
56+
DbType.Boolean,
57+
DbType.Date,
58+
DbType.DateTime,
59+
DbType.DateTimeOffset,
60+
DbType.Decimal,
61+
DbType.Double,
62+
DbType.Guid,
63+
DbType.Int16,
64+
DbType.Int32,
65+
DbType.Int64,
66+
DbType.Single,
67+
DbType.String,
68+
DbType.Time,
69+
});
7070

71-
public static Type NullValueExceptionType => typeof(InvalidCastException);
72-
}
71+
public static Type NullValueExceptionType => typeof(InvalidCastException);
7372
}

src/AdoNet.Databases/SqlServerDatabase.cs

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
using System.Data.SqlTypes;
66
using AdoNet.Specification.Tests;
77

8-
namespace AdoNet.Databases
8+
namespace AdoNet.Databases;
9+
10+
public static class SqlServerDatabase
911
{
10-
public static class SqlServerDatabase
12+
public static void CreateSelectValueTable(IDbFactoryFixture factoryFixture)
1113
{
12-
public static void CreateSelectValueTable(IDbFactoryFixture factoryFixture)
13-
{
14-
Utility.ExecuteNonQuery(factoryFixture, @"drop table if exists select_value;
14+
Utility.ExecuteNonQuery(factoryFixture, @"drop table if exists select_value;
1515
create table select_value
1616
(
1717
Id int not null primary key,
@@ -40,38 +40,37 @@ insert into select_value values
4040
(4, null, 0, 0, -922337203685477.5808, '0001-01-1', '0001-01-01', '0001-01-01', 0.000000000000001, 2.23e-308, '33221100-5544-7766-9988-aabbccddeeff', -32768, -2147483648, -9223372036854775808, 1.18e-38, null, '00:00:00'),
4141
(5, null, 1, 255, 922337203685477.5807, '9999-12-31', '9999-12-31 23:59:59.999', '9999-12-31 23:59:59.999 +14:00', 99999999999999999999.999999999999999, 1.79e308, 'ccddeeff-aabb-8899-7766-554433221100', 32767, 2147483647, 9223372036854775807, 3.40e38, null, '23:59:59.999');
4242
");
43-
}
43+
}
4444

45-
public static void DropSelectValueTable(IDbFactoryFixture factoryFixture) => Utility.ExecuteNonQuery(factoryFixture, "drop table if exists select_value;");
45+
public static void DropSelectValueTable(IDbFactoryFixture factoryFixture) => Utility.ExecuteNonQuery(factoryFixture, "drop table if exists select_value;");
4646

47-
public static string CreateSelectSql(DbType dbType, ValueKind kind) => $"SELECT [{dbType.ToString()}] from select_value WHERE Id = {(int) kind};";
47+
public static string CreateSelectSql(DbType dbType, ValueKind kind) => $"SELECT [{dbType.ToString()}] from select_value WHERE Id = {(int) kind};";
4848

49-
public static string CreateSelectSql(byte[] value) => $"SELECT 0x{BitConverter.ToString(value).Replace("-", "")}";
49+
public static string CreateSelectSql(byte[] value) => $"SELECT 0x{BitConverter.ToString(value).Replace("-", "")}";
5050

51-
public static string SelectNoRows => "SELECT 1 WHERE 0 = 1;";
51+
public static string SelectNoRows => "SELECT 1 WHERE 0 = 1;";
5252

53-
public static string DeleteNoRows => "DELETE FROM select_value WHERE 0 = 1;";
53+
public static string DeleteNoRows => "DELETE FROM select_value WHERE 0 = 1;";
5454

55-
public static IReadOnlyCollection<DbType> SupportedDbTypes { get; } = new ReadOnlyCollection<DbType>(new[]
56-
{
57-
DbType.Binary,
58-
DbType.Boolean,
59-
DbType.Byte,
60-
DbType.Currency,
61-
DbType.Date,
62-
DbType.DateTime,
63-
DbType.DateTimeOffset,
64-
DbType.Decimal,
65-
DbType.Double,
66-
DbType.Guid,
67-
DbType.Int16,
68-
DbType.Int32,
69-
DbType.Int64,
70-
DbType.Single,
71-
DbType.String,
72-
DbType.Time,
73-
});
55+
public static IReadOnlyCollection<DbType> SupportedDbTypes { get; } = new ReadOnlyCollection<DbType>(new[]
56+
{
57+
DbType.Binary,
58+
DbType.Boolean,
59+
DbType.Byte,
60+
DbType.Currency,
61+
DbType.Date,
62+
DbType.DateTime,
63+
DbType.DateTimeOffset,
64+
DbType.Decimal,
65+
DbType.Double,
66+
DbType.Guid,
67+
DbType.Int16,
68+
DbType.Int32,
69+
DbType.Int64,
70+
DbType.Single,
71+
DbType.String,
72+
DbType.Time,
73+
});
7474

75-
public static Type NullValueExceptionType => typeof(SqlNullValueException);
76-
}
75+
public static Type NullValueExceptionType => typeof(SqlNullValueException);
7776
}

src/AdoNet.Databases/SqliteDatabase.cs

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
using System.Data;
55
using AdoNet.Specification.Tests;
66

7-
namespace AdoNet.Databases
7+
namespace AdoNet.Databases;
8+
9+
public static class SqliteDatabase
810
{
9-
public static class SqliteDatabase
11+
public static void CreateSelectValueTable(IDbFactoryFixture factoryFixture)
1012
{
11-
public static void CreateSelectValueTable(IDbFactoryFixture factoryFixture)
12-
{
13-
Utility.ExecuteNonQuery(factoryFixture, @"drop table if exists select_value;
13+
Utility.ExecuteNonQuery(factoryFixture, @"drop table if exists select_value;
1414
create table select_value
1515
(
1616
Id integer not null primary key,
@@ -35,34 +35,33 @@ insert into select_value values
3535
(4, null, 0, 0, '0001-01-01', 0.000000000000001, 2.23e-308, '33221100-5544-7766-9988-aabbccddeeff', -32768, -2147483648, -9223372036854775808, 1.18e-38, null),
3636
(5, null, 1, 255, '9999-12-31 23:59:59.999', 99999999999999999999.999999999999999, 1.79e308, 'ccddeeff-aabb-8899-7766-554433221100', 32767, 2147483647, 9223372036854775807, 3.40e38, null);
3737
");
38-
}
38+
}
3939

40-
public static void DropSelectValueTable(IDbFactoryFixture factoryFixture) => Utility.ExecuteNonQuery(factoryFixture, "drop table if exists select_value;");
40+
public static void DropSelectValueTable(IDbFactoryFixture factoryFixture) => Utility.ExecuteNonQuery(factoryFixture, "drop table if exists select_value;");
4141

42-
public static string CreateSelectSql(DbType dbType, ValueKind kind) => $"SELECT `{dbType.ToString()}` from select_value WHERE Id = {(int) kind};";
42+
public static string CreateSelectSql(DbType dbType, ValueKind kind) => $"SELECT `{dbType.ToString()}` from select_value WHERE Id = {(int) kind};";
4343

44-
public static string CreateSelectSql(byte[] value) => $"SELECT X'{BitConverter.ToString(value).Replace("-", "")}'";
44+
public static string CreateSelectSql(byte[] value) => $"SELECT X'{BitConverter.ToString(value).Replace("-", "")}'";
4545

46-
public static string SelectNoRows => "SELECT 1 WHERE 0 = 1;";
46+
public static string SelectNoRows => "SELECT 1 WHERE 0 = 1;";
4747

48-
public static string DeleteNoRows => "DELETE FROM select_value WHERE 0 = 1;";
48+
public static string DeleteNoRows => "DELETE FROM select_value WHERE 0 = 1;";
4949

50-
public static IReadOnlyCollection<DbType> SupportedDbTypes { get; } = new ReadOnlyCollection<DbType>(new[]
51-
{
52-
DbType.Binary,
53-
DbType.Boolean,
54-
DbType.Byte,
55-
DbType.DateTime,
56-
DbType.Decimal,
57-
DbType.Double,
58-
DbType.Guid,
59-
DbType.Int16,
60-
DbType.Int32,
61-
DbType.Int64,
62-
DbType.Single,
63-
DbType.String,
64-
});
50+
public static IReadOnlyCollection<DbType> SupportedDbTypes { get; } = new ReadOnlyCollection<DbType>(new[]
51+
{
52+
DbType.Binary,
53+
DbType.Boolean,
54+
DbType.Byte,
55+
DbType.DateTime,
56+
DbType.Decimal,
57+
DbType.Double,
58+
DbType.Guid,
59+
DbType.Int16,
60+
DbType.Int32,
61+
DbType.Int64,
62+
DbType.Single,
63+
DbType.String,
64+
});
6565

66-
public static Type NullValueExceptionType => typeof(InvalidCastException);
67-
}
66+
public static Type NullValueExceptionType => typeof(InvalidCastException);
6867
}

src/AdoNet.Databases/Utility.cs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
using System;
22
using AdoNet.Specification.Tests;
33

4-
namespace AdoNet.Databases
4+
namespace AdoNet.Databases;
5+
6+
public static class Utility
57
{
6-
public static class Utility
8+
public static void ExecuteNonQuery(IDbFactoryFixture factoryFixture, string sql)
79
{
8-
public static void ExecuteNonQuery(IDbFactoryFixture factoryFixture, string sql)
10+
using (var connection = factoryFixture.Factory.CreateConnection())
911
{
10-
using (var connection = factoryFixture.Factory.CreateConnection())
11-
{
12-
connection.ConnectionString = Environment.GetEnvironmentVariable("ConnectionString") ?? factoryFixture.ConnectionString;
13-
connection.Open();
12+
connection.ConnectionString = Environment.GetEnvironmentVariable("ConnectionString") ?? factoryFixture.ConnectionString;
13+
connection.Open();
1414

15-
using (var command = connection.CreateCommand())
16-
{
17-
command.CommandText = sql;
18-
command.ExecuteNonQuery();
19-
}
15+
using (var command = connection.CreateCommand())
16+
{
17+
command.CommandText = sql;
18+
command.ExecuteNonQuery();
2019
}
2120
}
2221
}

0 commit comments

Comments
 (0)