Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@
<Compile Include="$(CommonSourceRoot)\Microsoft\Data\ProviderBase\DbConnectionFactory.cs">
<Link>Microsoft\Data\ProviderBase\DbConnectionFactory.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ConnectionPool\ChannelDbConnectionPool.cs">
<Link>Microsoft\Data\SqlClient\ConnectionPool\ChannelDbConnectionPool.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ConnectionPool\DbConnectionPoolAuthenticationContext.cs">
<Link>Microsoft\Data\SqlClient\ConnectionPool\DbConnectionPoolAuthenticationContext.cs</Link>
</Compile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,9 @@
<Compile Include="$(CommonSourceRoot)Microsoft\Data\ProviderBase\DbConnectionInternal.cs">
<Link>Microsoft\Data\ProviderBase\DbConnectionInternal.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ConnectionPool\ChannelDbConnectionPool.cs">
<Link>Microsoft\Data\SqlClient\ConnectionPool\ChannelDbConnectionPool.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ConnectionPool\DbConnectionPoolAuthenticationContext.cs">
<Link>Microsoft\Data\SqlClient\ConnectionPool\DbConnectionPoolAuthenticationContext.cs</Link>
</Compile>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Concurrent;
using System.Data.Common;
using System.Threading.Tasks;
using System.Transactions;
using Microsoft.Data.Common;
using Microsoft.Data.Common.ConnectionString;
using Microsoft.Data.ProviderBase;

#nullable enable

namespace Microsoft.Data.SqlClient.ConnectionPool
{
/// <summary>
/// A connection pool implementation based on the channel data structure.
/// Provides methods to manage the pool of connections, including acquiring and releasing connections.
/// </summary>
internal sealed class ChannelDbConnectionPool : IDbConnectionPool
{
#region Properties
/// <inheritdoc />
public ConcurrentDictionary<DbConnectionPoolAuthenticationContextKey, DbConnectionPoolAuthenticationContext> AuthenticationContexts => throw new NotImplementedException();

/// <inheritdoc />
public DbConnectionFactory ConnectionFactory => throw new NotImplementedException();

/// <inheritdoc />
public int Count => throw new NotImplementedException();

/// <inheritdoc />
public bool ErrorOccurred => throw new NotImplementedException();

/// <inheritdoc />
public int Id => throw new NotImplementedException();

/// <inheritdoc />
public DbConnectionPoolIdentity Identity => throw new NotImplementedException();

/// <inheritdoc />
public bool IsRunning => throw new NotImplementedException();

/// <inheritdoc />
public TimeSpan LoadBalanceTimeout => throw new NotImplementedException();

/// <inheritdoc />
public DbConnectionPoolGroup PoolGroup => throw new NotImplementedException();

/// <inheritdoc />
public DbConnectionPoolGroupOptions PoolGroupOptions => throw new NotImplementedException();

/// <inheritdoc />
public DbConnectionPoolProviderInfo ProviderInfo => throw new NotImplementedException();

/// <inheritdoc />
public DbConnectionPoolState State
{
get => throw new NotImplementedException();
set => throw new NotImplementedException();
}

/// <inheritdoc />
public bool UseLoadBalancing => throw new NotImplementedException();
#endregion



#region Methods
/// <inheritdoc />
public void Clear()
{
throw new NotImplementedException();
}

/// <inheritdoc />
public void PutObjectFromTransactedPool(DbConnectionInternal obj)
{
throw new NotImplementedException();
}

/// <inheritdoc />
public DbConnectionInternal ReplaceConnection(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
{
throw new NotImplementedException();
}

/// <inheritdoc />
public void ReturnInternalConnection(DbConnectionInternal obj, object owningObject)
{
throw new NotImplementedException();
}

/// <inheritdoc />
public void Shutdown()
{
throw new NotImplementedException();
}

/// <inheritdoc />
public void Startup()
{
throw new NotImplementedException();
}

/// <inheritdoc />
public void TransactionEnded(Transaction transaction, DbConnectionInternal transactedObject)
{
throw new NotImplementedException();
}

/// <inheritdoc />
public bool TryGetConnection(DbConnection owningObject, TaskCompletionSource<DbConnectionInternal> taskCompletionSource, DbConnectionOptions userOptions, out DbConnectionInternal connection)
{
throw new NotImplementedException();
}
#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<ItemGroup Condition="$(TargetGroup) == 'netfx'">
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="$(SystemRuntimeInteropServicesRuntimeInformationVersion)" />
<ProjectReference Include="$(NetFxSource)src\Microsoft.Data.SqlClient.csproj" />
<Reference Include="System.Transactions" />
</ItemGroup>
<!-- .NET references -->
<ItemGroup Condition="'$(TargetGroup)'=='netcoreapp'">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Data.Common;
using System.Threading.Tasks;
using System.Transactions;
using Microsoft.Data.SqlClient.ConnectionPool;
using Xunit;

namespace Microsoft.Data.SqlClient.UnitTests
{
public class ChannelDbConnectionPoolTest
{
private readonly ChannelDbConnectionPool _pool;

public ChannelDbConnectionPoolTest()
{
_pool = new ChannelDbConnectionPool();
}

[Fact]
public void TestAuthenticationContexts()
{
Assert.Throws<NotImplementedException>(() => _ = _pool.AuthenticationContexts);
}

[Fact]
public void TestConnectionFactory()
{
Assert.Throws<NotImplementedException>(() => _ = _pool.ConnectionFactory);
}

[Fact]
public void TestCount()
{
Assert.Throws<NotImplementedException>(() => _ = _pool.Count);
}

[Fact]
public void TestErrorOccurred()
{
Assert.Throws<NotImplementedException>(() => _ = _pool.ErrorOccurred);
}

[Fact]
public void TestId()
{
Assert.Throws<NotImplementedException>(() => _ = _pool.Id);
}

[Fact]
public void TestIdentity()
{
Assert.Throws<NotImplementedException>(() => _ = _pool.Identity);
}

[Fact]
public void TestIsRunning()
{
Assert.Throws<NotImplementedException>(() => _ = _pool.IsRunning);
}

[Fact]
public void TestLoadBalanceTimeout()
{
Assert.Throws<NotImplementedException>(() => _ = _pool.LoadBalanceTimeout);
}

[Fact]
public void TestPoolGroup()
{
Assert.Throws<NotImplementedException>(() => _ = _pool.PoolGroup);
}

[Fact]
public void TestPoolGroupOptions()
{
Assert.Throws<NotImplementedException>(() => _ = _pool.PoolGroupOptions);
}

[Fact]
public void TestProviderInfo()
{
Assert.Throws<NotImplementedException>(() => _ = _pool.ProviderInfo);
}

[Fact]
public void TestStateGetter()
{
Assert.Throws<NotImplementedException>(() => _ = _pool.State);
}

[Fact]
public void TestStateSetter()
{
Assert.Throws<NotImplementedException>(() => _pool.State = DbConnectionPoolState.Running);
}

[Fact]
public void TestUseLoadBalancing()
{
Assert.Throws<NotImplementedException>(() => _ = _pool.UseLoadBalancing);
}

[Fact]
public void TestClear()
{
Assert.Throws<NotImplementedException>(() => _pool.Clear());
}

[Fact]
public void TestPutObjectFromTransactedPool()
{
Assert.Throws<NotImplementedException>(() => _pool.PutObjectFromTransactedPool(null!));
}

[Fact]
public void TestReplaceConnection()
{
Assert.Throws<NotImplementedException>(() => _pool.ReplaceConnection(null!, null!, null!));
}

[Fact]
public void TestReturnInternalConnection()
{
Assert.Throws<NotImplementedException>(() => _pool.ReturnInternalConnection(null!, null!));
}

[Fact]
public void TestShutdown()
{
Assert.Throws<NotImplementedException>(() => _pool.Shutdown());
}

[Fact]
public void TestStartup()
{
Assert.Throws<NotImplementedException>(() => _pool.Startup());
}

[Fact]
public void TestTransactionEnded()
{
Assert.Throws<NotImplementedException>(() => _pool.TransactionEnded(null!, null!));
}

[Fact]
public void TestTryGetConnection()
{
Assert.Throws<NotImplementedException>(() => _pool.TryGetConnection(null!, null!, null!, out _));
}
}
}
Loading