Skip to content

Commit 18ac974

Browse files
committed
Moving GetOrDefault into extension
1 parent fd4939e commit 18ac974

13 files changed

+123
-29
lines changed

src/Builder/IBuilderContext.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public interface IBuilderContext
4949
NamedTypeBuildKey OriginalBuildKey { get; }
5050

5151
/// <summary>
52-
/// Get the current build key for the current build operation.
52+
/// GetOrDefault the current build key for the current build operation.
5353
/// </summary>
5454
NamedTypeBuildKey BuildKey { get; set; }
5555

@@ -110,7 +110,7 @@ public interface IBuilderContext
110110
void AddResolverOverrides(IEnumerable<ResolverOverride> newOverrides);
111111

112112
/// <summary>
113-
/// Get a <see cref="IDependencyResolverPolicy"/> object for the given <paramref name="dependencyType"/>
113+
/// GetOrDefault a <see cref="IDependencyResolverPolicy"/> object for the given <paramref name="dependencyType"/>
114114
/// or null if that dependency hasn't been overridden.
115115
/// </summary>
116116
/// <param name="dependencyType">Type of the dependency.</param>

src/Builder/Operation/PropertyOperation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public override string ToString()
3838
}
3939

4040
/// <summary>
41-
/// Get a format string used to create the description. Called by
41+
/// GetOrDefault a format string used to create the description. Called by
4242
/// the base <see cref='ToString'/> method.
4343
/// </summary>
4444
/// <returns>The format string.</returns>

src/Builder/Operation/ResolvingPropertyValueOperation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public ResolvingPropertyValueOperation(Type typeBeingConstructed, string propert
2020
}
2121

2222
/// <summary>
23-
/// Get a format string used to create the description. Called by
23+
/// GetOrDefault a format string used to create the description. Called by
2424
/// the base <see cref='PropertyOperation.ToString'/> method.
2525
/// </summary>
2626
/// <returns>The format string.</returns>

src/Builder/Operation/SettingPropertyOperation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public SettingPropertyOperation(Type typeBeingConstructed, string propertyName)
2222
}
2323

2424
/// <summary>
25-
/// Get a format string used to create the description. Called by
25+
/// GetOrDefault a format string used to create the description. Called by
2626
/// the base <see cref='PropertyOperation.ToString'/> method.
2727
/// </summary>
2828
/// <returns>The format string.</returns>

src/IUnityContainer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public interface IUnityContainer : IDisposable
124124
IUnityContainer CreateChildContainer();
125125

126126
/// <summary>
127-
/// Get a sequence of <see cref="IContainerRegistration"/> that describe the current state
127+
/// GetOrDefault a sequence of <see cref="IContainerRegistration"/> that describe the current state
128128
/// of the container.
129129
/// </summary>
130130
IEnumerable<IContainerRegistration> Registrations { get; }

src/Lifetime/LifetimeManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Unity.Lifetime
88
/// </summary>
99
public abstract class LifetimeManager : ILifetimePolicy
1010
{
11-
// Get or set the InUse flag. Internal because it should only be touched from
11+
// GetOrDefault or set the InUse flag. Internal because it should only be touched from
1212
// the Register methods in the container.
1313
public bool InUse { get; set; }
1414

src/Policy/IPolicyList.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@ public interface IPolicyList
2222
/// </summary>
2323
void ClearAll();
2424

25-
/// <summary>
26-
/// Removes a default policy.
27-
/// </summary>
28-
/// <param name="policyInterface">The type the policy was registered as.</param>
29-
void ClearDefault(Type policyInterface);
30-
3125
/// <summary>
3226
/// Gets an individual policy.
3327
/// </summary>
@@ -36,18 +30,18 @@ public interface IPolicyList
3630
/// <param name="containingPolicyList">The policy list in the chain that the searched for policy was found in, null if the policy was
3731
/// not found.</param>
3832
/// <returns>The policy in the list, if present; returns null otherwise.</returns>
39-
IBuilderPolicy Get(Type policyInterface, object buildKey, out IPolicyList containingPolicyList);
33+
IBuilderPolicy GetOrDefault(Type policyInterface, object buildKey, out IPolicyList containingPolicyList);
4034

4135
/// <summary>
42-
/// Get the non default policy.
36+
/// GetOrDefault the non default policy.
4337
/// </summary>
4438
/// <param name="policyInterface">The interface the policy is registered under.</param>
4539
/// <param name="buildKey">The key the policy applies to.</param>
4640
/// <param name="localOnly">True if the search should be in the local policy list only; otherwise false to search up the parent chain.</param>
4741
/// <param name="containingPolicyList">The policy list in the chain that the searched for policy was found in, null if the policy was
4842
/// not found.</param>
4943
/// <returns>The policy in the list if present; returns null otherwise.</returns>
50-
IBuilderPolicy GetNoDefault(Type policyInterface, object buildKey, out IPolicyList containingPolicyList);
44+
IBuilderPolicy Get(Type policyInterface, object buildKey, out IPolicyList containingPolicyList);
5145

5246
/// <summary>
5347
/// Sets an individual policy.

src/Policy/IResolverPolicy.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Unity.Policy
88
public interface IResolverPolicy : IBuilderPolicy
99
{
1010
/// <summary>
11-
/// Get the value
11+
/// GetOrDefault the value
1212
/// </summary>
1313
/// <param name="context">Current build context.</param>
1414
/// <returns>The value for the dependency.</returns>

src/ResolverPolicy/DependencyResolverTrackerPolicy.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public void RemoveResolvers(IPolicyList policies)
4646
// Helper methods for adding and removing the tracker policy.
4747

4848
/// <summary>
49-
/// Get an instance that implements <see cref="IDependencyResolverTrackerPolicy"/>,
49+
/// GetOrDefault an instance that implements <see cref="IDependencyResolverTrackerPolicy"/>,
5050
/// either the current one in the policy set or creating a new one if it doesn't
5151
/// exist.
5252
/// </summary>

src/ResolverPolicy/FixedTypeResolverPolicy.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public FixedTypeResolverPolicy(Type typeToBuild)
2727
#region IDependencyResolverPolicy Members
2828

2929
/// <summary>
30-
/// Get the value for a dependency.
30+
/// GetOrDefault the value for a dependency.
3131
/// </summary>
3232
/// <param name="context">Current build context.</param>
3333
/// <returns>The value for the dependency.</returns>

0 commit comments

Comments
 (0)