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 @@ -31,6 +31,9 @@
<Compile Include="../../ref/Microsoft.Data.SqlClient.Diagnostics.cs" />
<Compile Include="../../ref/Microsoft.Data.SqlClient.Server.cs" />
<Compile Include="../../ref/Microsoft.Data.SqlTypes.cs" />
<Compile Include="$(CommonSourceRoot)TypeForwards.Abstractions.cs">
<Link>TypeForwards.Abstractions.cs</Link>
</Compile>
Comment thread
paulmedynski marked this conversation as resolved.
</ItemGroup>

<!-- References -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,9 @@
<Compile Include="$(CommonSourceRoot)TypeForwards.netcore.cs">
<Link>TypeForwards.netcore.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)TypeForwards.Abstractions.cs">
<Link>TypeForwards.Abstractions.cs</Link>
</Compile>
</ItemGroup>

<!-- Resource Files ================================================== -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
<Compile Include="../../ref/Microsoft.Data.SqlClient.Diagnostics.cs" />
<Compile Include="../../ref/Microsoft.Data.SqlClient.Server.cs" />
<Compile Include="../../ref/Microsoft.Data.SqlTypes.cs" />
<Compile Include="$(CommonSourceRoot)TypeForwards.Abstractions.cs">
<Link>TypeForwards.Abstractions.cs</Link>
</Compile>
</ItemGroup>

<!-- References -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,9 @@
<Compile Include="$(CommonSourceRoot)System\Runtime\CompilerServices\IsExternalInit.netfx.cs">
<Link>System\Runtime\CompilerServices\IsExternalInit.netfx.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)TypeForwards.Abstractions.cs">
<Link>TypeForwards.Abstractions.cs</Link>
</Compile>
</ItemGroup>

<!-- Resource Files ================================================== -->
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// 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.

[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.Data.SqlClient.SqlAuthenticationMethod))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.Data.SqlClient.SqlAuthenticationParameters))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.Data.SqlClient.SqlAuthenticationProvider))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.Data.SqlClient.SqlAuthenticationProviderException))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.Data.SqlClient.SqlAuthenticationToken))]
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// 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.Reflection;
using Xunit;

namespace Microsoft.Data.SqlClient.UnitTests
{
public class TypeForwardTests
{
private static readonly Assembly s_sqlClientAssembly = typeof(SqlConnection).Assembly;

[Theory]
[InlineData("Microsoft.Data.SqlClient.SqlAuthenticationMethod", true)]
[InlineData("Microsoft.Data.SqlClient.SqlAuthenticationParameters", false)]
[InlineData("Microsoft.Data.SqlClient.SqlAuthenticationProvider", false)]
[InlineData("Microsoft.Data.SqlClient.SqlAuthenticationProviderException", false)]
[InlineData("Microsoft.Data.SqlClient.SqlAuthenticationToken", false)]
public void AbstractionsType_CanBeLoadedFromSqlClientAssembly(string typeName, bool isEnum)
{
// Types moved to the Abstractions assembly must remain loadable via the
// Microsoft.Data.SqlClient assembly for backward compatibility.
Type? type = s_sqlClientAssembly.GetType(typeName, throwOnError: true);

Assert.NotNull(type);
Assert.Equal(isEnum, type.IsEnum);

// Assert that the assembly containing the type is the Abstractions assembly.
Assert.Equal("Microsoft.Data.SqlClient.Extensions.Abstractions", type.Assembly.GetName().Name);
}
}
}
Loading