Skip to content

Commit

Permalink
Excludes special types from the Bind call without type parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolayPianikov committed Mar 8, 2024
1 parent 2cb6629 commit ce55c5d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Pure.DI.Core/Components/Api.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,7 @@ internal enum Tag
internal interface IConfiguration
{
/// <summary>
/// Begins the binding definition for the implementation type itself, and if the implementation is a class or structure, for all abstract but NOT special types that are directly implemented.
/// Begins the binding definition for the implementation type itself, and if the implementation is not an abstract class or structure, for all abstract but NOT special types that are directly implemented.
/// Special types include:
/// <list type="bullet">
/// <item>System.Object</item>
Expand Down Expand Up @@ -1382,7 +1382,7 @@ internal interface IConfiguration
internal interface IBinding
{
/// <summary>
/// Begins the binding definition for the implementation type itself, and if the implementation is a class or structure, for all abstract but NOT special types that are directly implemented.
/// Begins the binding definition for the implementation type itself, and if the implementation is not an abstract class or structure, for all abstract but NOT special types that are directly implemented.
/// Special types include:
/// <list type="bullet">
/// <item>System.Object</item>
Expand Down
2 changes: 1 addition & 1 deletion src/Pure.DI.Core/Core/BindingBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public MdBinding Build(MdSetup setup)
if (type is not null && contractsSource is not null)
{
var baseSymbols = Enumerable.Empty<ITypeSymbol>();
if (type is { SpecialType: SpecialType.None, TypeKind: TypeKind.Class or TypeKind.Struct })
if (type is { SpecialType: SpecialType.None, TypeKind: TypeKind.Class or TypeKind.Struct, IsAbstract: false })
{
baseSymbols = baseSymbolsProvider
.GetBaseSymbols(type, 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
$v=true
$p=1
$d=Abstractions binding
$h=You can use the `Bind(...)` method without type parameters. In this case binding will be performed for the implementation type itself, and if the implementation is a class or structure, for all abstract but NOT special types that are directly implemented.
$h=You can use the `Bind(...)` method without type parameters. In this case binding will be performed for the implementation type itself, and if the implementation is not an abstract class or structure, for all abstract but NOT special types that are directly implemented.
$h=Special types include:
$h=
$h=- `System.Object`
Expand All @@ -28,7 +28,7 @@
// ReSharper disable UnusedMember.Local
// ReSharper disable ArrangeTypeMemberModifiers
#pragma warning disable CS9113 // Parameter is unread.
namespace Pure.DI.UsageTests.Basics.AbstractionsBindingScenario;
namespace Pure.DI.UsageTests.Basics.SimpleBindingScenario;

using Xunit;

Expand All @@ -55,7 +55,7 @@ public void Run()
// Specifies to create a partial class "Composition"
DI.Setup("Composition")
// Begins the binding definition for the implementation type itself,
// and if the implementation is a class or structure,
// and if the implementation is not an abstract class or structure,
// for all abstract but NOT special types that are directly implemented.
// So that's the equivalent of the following:
// .Bind<IDependency, IOtherDependency, Dependency>()
Expand Down

0 comments on commit ce55c5d

Please sign in to comment.