Skip to content

Commit

Permalink
Fixed naming convention of private/internal properties
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-mhofman committed Nov 7, 2023
1 parent 30a3c7c commit cd5b568
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 33 deletions.
18 changes: 3 additions & 15 deletions CodingConventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ public class ExampleClass
}
```

#### Public property
#### Property

Use PascalCase, eg. `SomeProperty`.

```csharp
public ExampleProperty
{
get => _exampleProperty;
set => _exampleProperty = value;
get;
set;
}
```

Expand All @@ -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).
Expand Down
4 changes: 2 additions & 2 deletions Snowflake.Data.Tests/UnitTests/ConnectionPoolManagerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
30 changes: 15 additions & 15 deletions Snowflake.Data/Client/SnowflakeDbConnectionPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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<SFSession> 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
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Snowflake.Data/Core/Session/SessionPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void Dispose()
ClearAllPools();
}

internal static ISessionFactory sessionFactory
internal static ISessionFactory SessionFactory
{
set => s_sessionFactory = value;
}
Expand Down

0 comments on commit cd5b568

Please sign in to comment.