Skip to content

Commit 06e06db

Browse files
committed
Fixed #35
1 parent a01eb9b commit 06e06db

File tree

4 files changed

+72
-43
lines changed

4 files changed

+72
-43
lines changed

src/Builder/Strategy/IRegisterStrategy.cs

Lines changed: 0 additions & 43 deletions
This file was deleted.

src/IContainerContext.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using Unity.Lifetime;
2+
using Unity.Policy;
3+
4+
namespace Unity
5+
{
6+
/// <summary>
7+
/// Container interface exposing engine to internal container parts
8+
/// </summary>
9+
public interface IContainerContext
10+
{
11+
/// <summary>
12+
/// The container that this context is associated with.
13+
/// </summary>
14+
/// <value>The <see cref="IUnityContainer"/> object.</value>
15+
IUnityContainer Container { get; }
16+
17+
/// <summary>
18+
/// The <see cref="ILifetimeContainer"/> that this container uses.
19+
/// </summary>
20+
/// <value>The <see cref="ILifetimeContainer"/> is used to manage <see cref="IDisposable"/> objects that the container is managing.</value>
21+
ILifetimeContainer Lifetime { get; }
22+
23+
/// <summary>
24+
/// The policies this container uses.
25+
/// </summary>
26+
/// <remarks>The <see cref="IPolicyList"/> the that container uses to build objects.</remarks>
27+
IPolicyList Policies { get; }
28+
29+
}
30+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
2+
3+
using System;
4+
using Unity.Builder;
5+
6+
namespace Unity.Policy
7+
{
8+
public class OverriddenBuildPlanMarkerPolicy : IBuildPlanPolicy
9+
{
10+
/// <summary>
11+
/// Creates an instance of this build plan's type, or fills
12+
/// in the existing type if passed in.
13+
/// </summary>
14+
/// <param name="context">Context used to build up the object.</param>
15+
public void BuildUp(IBuilderContext context)
16+
{
17+
throw new InvalidOperationException(Constants.MarkerBuildPlanInvoked);
18+
}
19+
}
20+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System;
2+
using Unity.Lifetime;
3+
using Unity.Registration;
4+
5+
namespace Unity.Strategy
6+
{
7+
public interface IRegisterTypeStrategy
8+
{
9+
/// <summary>
10+
/// Register a type mapping with the container, where the created instances will use
11+
/// the given <see cref="LifetimeManager"/>.
12+
/// </summary>
13+
/// <param name="policies"><see cref="IPolicyList"/> holding the registration.</param>
14+
/// <param name="typeFrom"><see cref="Type"/> that will be requested.</param>
15+
/// <param name="typeTo"><see cref="Type"/> that will actually be returned.</param>
16+
/// <param name="name">Name to use for registration, null if a default registration.</param>
17+
/// <param name="lifetimeManager">The <see cref="LifetimeManager"/> that controls the lifetime
18+
/// of the returned instance.</param>
19+
/// <param name="injectionMembers">Injection configuration objects. Can be null.</param>
20+
void RegisterType(IContainerContext context, Type typeFrom, Type typeTo, string name, LifetimeManager lifetimeManager, params InjectionMember[] injectionMembers);
21+
}
22+
}

0 commit comments

Comments
 (0)