Skip to content

Commit d26230f

Browse files
committed
Fixing MS.Ext.DI
1 parent c7d916a commit d26230f

4 files changed

Lines changed: 25 additions & 3 deletions

File tree

src/Properties/AssemblyInfo.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
using System;
2+
using System.Runtime.CompilerServices;
23
using System.Security;
34

45
[assembly: CLSCompliant(true)]
56
[assembly: AllowPartiallyTrustedCallers]
7+
8+
9+
[assembly: InternalsVisibleTo("Unity.Microsoft.DependencyInjection, PublicKey=" +
10+
"002400000480000094000000060200000024000052534131000400000100010037b16015885a7a" +
11+
"c3c63f3c10b23972ec0dfd6db643eaef45ea2297bdfdc53b1945017fc76fd038dc6e7bf9190024" +
12+
"d5435fa49630fdfd143e3149a1506b895fbcce017df1d4f0eac6f05f6d257be45c7be9a8aa8d3d" +
13+
"4164892dc75e7c379a22da0d986db393fbd09e4ba42398c80a305361553ef90eb3484d9cf12df9" +
14+
"0fc0e6e3")]

src/Registration/ContainerRegistration.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ public ContainerRegistration(LinkedNode<Type, object> validators, Type mappedTo,
3030
/// The type that this registration is mapped to. If no type mapping was done, the
3131
/// <see cref="Type"/> property and this one will have the same value.
3232
/// </summary>
33-
public Type Type { get; }
33+
public virtual Type Type { get; }
3434

3535
/// <summary>
3636
/// The lifetime manager for this registration.
3737
/// </summary>
3838
/// <remarks>
3939
/// This property will be null if this registration is for an open generic.</remarks>
40-
public LifetimeManager LifetimeManager => (LifetimeManager)Value;
40+
public virtual LifetimeManager LifetimeManager => (LifetimeManager)Value;
4141

4242
#endregion
4343
}

src/Registration/InternalRegistration.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,17 @@ public virtual void Set(Type policyInterface, object policy)
6161
}
6262
else
6363
{
64+
for (var node = (LinkedNode<Type, object>)this; node != null; node = node.Next)
65+
{
66+
if (node.Key == policyInterface)
67+
{
68+
// Found it
69+
node.Value = policy;
70+
return;
71+
}
72+
}
73+
74+
// If not found, insert after the current object
6475
Next = new LinkedNode<Type, object>
6576
{
6677
Key = policyInterface,

src/UnityContainer.Implementation.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ public partial class UnityContainer
7979
[DebuggerBrowsable(DebuggerBrowsableState.Never)] internal Func<Type, bool> IsTypeExplicitlyRegistered;
8080

8181
private static readonly ContainerLifetimeManager _containerManager = new ContainerLifetimeManager();
82-
82+
#if DEBUG
83+
private string id = Guid.NewGuid().ToString();
84+
#endif
8385
#endregion
8486

8587

0 commit comments

Comments
 (0)