This repository has been archived by the owner on Dec 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial stab at #42 - I think it's going to work well, eventually ;)
New test added to this which currently fails DELIBERATELY.
- Loading branch information
1 parent
1729a9c
commit 390a531
Showing
6 changed files
with
111 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Rezolver.Behaviours | ||
{ | ||
/// <summary> | ||
/// This extends the behaviour supplied by the AutoEnumerableBehaviour to the <see cref="OverridingContainer"/> | ||
/// class by chaining the enumerable from the overridden container to the enumerable produced by the overriding container. | ||
/// </summary> | ||
/// <remarks> | ||
/// Note that this class is not an <see cref="ITargetContainerBehaviour"/> like the <see cref="AutoEnumerableBehaviour"/>. | ||
/// | ||
/// It is an <see cref="IContainerBehaviour"/> because it only applies to instances of <see cref="OverridingContainer"/>.</remarks> | ||
public class OverridingEnumerableBehaviour : IContainerBehaviour | ||
{ | ||
public static OverridingEnumerableBehaviour Instance { get; } = new OverridingEnumerableBehaviour(); | ||
|
||
private OverridingEnumerableBehaviour() { } | ||
public void Attach(IContainer container, ITargetContainer targets) | ||
{ | ||
if (container == null) throw new ArgumentNullException(nameof(container)); | ||
if (targets == null) throw new ArgumentNullException(nameof(targets)); | ||
targets.RegisterContainer(typeof(IEnumerable<>), | ||
new ConcatenatingEnumerableContainer(container, targets)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters