diff --git a/CodingConventions.md b/CodingConventions.md index 41b55906a..0242f583e 100644 --- a/CodingConventions.md +++ b/CodingConventions.md @@ -85,15 +85,15 @@ public class ExampleClass } ``` -#### Public property +#### Property Use PascalCase, eg. `SomeProperty`. ```csharp public ExampleProperty { - get => _exampleProperty; - set => _exampleProperty = value; + get; + set; } ``` @@ -117,18 +117,6 @@ Use PascalCase, eg. `SomeConst`. } ``` -#### Private or internal property - -Use camelCase, eg. `someProperty`. - -```csharp -private exampleProperty -{ - get; - set; -} -``` - ### Method names Use PascalCase, eg. `SomeMethod` for all methods (normal, object members, static members, public, internal, private). diff --git a/Snowflake.Data.Tests/UnitTests/ConnectionPoolManagerTest.cs b/Snowflake.Data.Tests/UnitTests/ConnectionPoolManagerTest.cs index 908a919a6..66d6b5407 100644 --- a/Snowflake.Data.Tests/UnitTests/ConnectionPoolManagerTest.cs +++ b/Snowflake.Data.Tests/UnitTests/ConnectionPoolManagerTest.cs @@ -29,14 +29,14 @@ public static void BeforeAllTests() { s_poolConfig = new PoolConfig(); SnowflakeDbConnectionPool.SetConnectionPoolVersion(ConnectionPoolType.MultipleConnectionPool); - SessionPool.sessionFactory = new MockSessionFactory(); + SessionPool.SessionFactory = new MockSessionFactory(); } [OneTimeTearDown] public void AfterAllTests() { s_poolConfig.Reset(); - SessionPool.sessionFactory = new SessionFactory(); + SessionPool.SessionFactory = new SessionFactory(); } [Test] diff --git a/Snowflake.Data/Client/SnowflakeDbConnectionPool.cs b/Snowflake.Data/Client/SnowflakeDbConnectionPool.cs index cfdb5bfcc..46348cf61 100644 --- a/Snowflake.Data/Client/SnowflakeDbConnectionPool.cs +++ b/Snowflake.Data/Client/SnowflakeDbConnectionPool.cs @@ -19,7 +19,7 @@ public class SnowflakeDbConnectionPool private static IConnectionManager s_connectionManager; private const ConnectionPoolType DefaultConnectionPoolType = ConnectionPoolType.SingleConnectionCache; // TODO: set to MultipleConnectionPool once development of entire ConnectionPoolManager epic is complete - private static IConnectionManager connectionManager + private static IConnectionManager ConnectionManager { get { @@ -33,73 +33,73 @@ private static IConnectionManager connectionManager internal static SFSession GetSession(string connectionString, SecureString password) { s_logger.Debug($"SnowflakeDbConnectionPool::GetSession"); - return connectionManager.GetSession(connectionString, password); + return ConnectionManager.GetSession(connectionString, password); } internal static Task GetSessionAsync(string connectionString, SecureString password, CancellationToken cancellationToken) { s_logger.Debug($"SnowflakeDbConnectionPool::GetSessionAsync"); - return connectionManager.GetSessionAsync(connectionString, password, cancellationToken); + return ConnectionManager.GetSessionAsync(connectionString, password, cancellationToken); } internal static SessionPool GetPool(string connectionString) { s_logger.Debug($"SnowflakeDbConnectionPool::GetPool"); - return connectionManager.GetPool(connectionString); + return ConnectionManager.GetPool(connectionString); } internal static bool AddSession(SFSession session) { s_logger.Debug("SnowflakeDbConnectionPool::AddSession"); - return connectionManager.AddSession(session); + return ConnectionManager.AddSession(session); } public static void ClearAllPools() { s_logger.Debug("SnowflakeDbConnectionPool::ClearAllPools"); - connectionManager.ClearAllPools(); + ConnectionManager.ClearAllPools(); } public static void SetMaxPoolSize(int maxPoolSize) { s_logger.Debug("SnowflakeDbConnectionPool::SetMaxPoolSize"); - connectionManager.SetMaxPoolSize(maxPoolSize); + ConnectionManager.SetMaxPoolSize(maxPoolSize); } public static int GetMaxPoolSize() { s_logger.Debug("SnowflakeDbConnectionPool::GetMaxPoolSize"); - return connectionManager.GetMaxPoolSize(); + return ConnectionManager.GetMaxPoolSize(); } public static void SetTimeout(long connectionTimeout) { s_logger.Debug("SnowflakeDbConnectionPool::SetTimeout"); - connectionManager.SetTimeout(connectionTimeout); + ConnectionManager.SetTimeout(connectionTimeout); } public static long GetTimeout() { s_logger.Debug("SnowflakeDbConnectionPool::GetTimeout"); - return connectionManager.GetTimeout(); + return ConnectionManager.GetTimeout(); } public static int GetCurrentPoolSize() { s_logger.Debug("SnowflakeDbConnectionPool::GetCurrentPoolSize"); - return connectionManager.GetCurrentPoolSize(); + return ConnectionManager.GetCurrentPoolSize(); } public static bool SetPooling(bool isEnable) { s_logger.Debug("SnowflakeDbConnectionPool::SetPooling"); - return connectionManager.SetPooling(isEnable); + return ConnectionManager.SetPooling(isEnable); } public static bool GetPooling() { s_logger.Debug("SnowflakeDbConnectionPool::GetPooling"); - return connectionManager.GetPooling(); + return ConnectionManager.GetPooling(); } internal static void SetOldConnectionPoolVersion() // TODO: set to public once development of entire ConnectionPoolManager epic is complete @@ -127,9 +127,9 @@ internal static void SetConnectionPoolVersion(ConnectionPoolType requestedPoolTy internal static ConnectionPoolType GetConnectionPoolVersion() { - if (connectionManager != null) + if (ConnectionManager != null) { - switch (connectionManager) + switch (ConnectionManager) { case ConnectionCacheManager _: return ConnectionPoolType.SingleConnectionCache; case ConnectionPoolManager _: return ConnectionPoolType.MultipleConnectionPool; diff --git a/Snowflake.Data/Core/Session/SessionPool.cs b/Snowflake.Data/Core/Session/SessionPool.cs index 20b2b60cd..0463c0715 100644 --- a/Snowflake.Data/Core/Session/SessionPool.cs +++ b/Snowflake.Data/Core/Session/SessionPool.cs @@ -63,7 +63,7 @@ public void Dispose() ClearAllPools(); } - internal static ISessionFactory sessionFactory + internal static ISessionFactory SessionFactory { set => s_sessionFactory = value; }