Skip to content

Commit

Permalink
Fixed #35
Browse files Browse the repository at this point in the history
  • Loading branch information
ENikS committed Dec 29, 2017
1 parent a01eb9b commit 06e06db
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 43 deletions.
43 changes: 0 additions & 43 deletions src/Builder/Strategy/IRegisterStrategy.cs

This file was deleted.

30 changes: 30 additions & 0 deletions src/IContainerContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Unity.Lifetime;
using Unity.Policy;

namespace Unity
{
/// <summary>
/// Container interface exposing engine to internal container parts
/// </summary>
public interface IContainerContext
{
/// <summary>
/// The container that this context is associated with.
/// </summary>
/// <value>The <see cref="IUnityContainer"/> object.</value>
IUnityContainer Container { get; }

/// <summary>
/// The <see cref="ILifetimeContainer"/> that this container uses.
/// </summary>
/// <value>The <see cref="ILifetimeContainer"/> is used to manage <see cref="IDisposable"/> objects that the container is managing.</value>
ILifetimeContainer Lifetime { get; }

/// <summary>
/// The policies this container uses.
/// </summary>
/// <remarks>The <see cref="IPolicyList"/> the that container uses to build objects.</remarks>
IPolicyList Policies { get; }

}
}
20 changes: 20 additions & 0 deletions src/Policy/OverriddenBuildPlanMarkerPolicy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.

using System;
using Unity.Builder;

namespace Unity.Policy
{
public class OverriddenBuildPlanMarkerPolicy : IBuildPlanPolicy
{
/// <summary>
/// Creates an instance of this build plan's type, or fills
/// in the existing type if passed in.
/// </summary>
/// <param name="context">Context used to build up the object.</param>
public void BuildUp(IBuilderContext context)
{
throw new InvalidOperationException(Constants.MarkerBuildPlanInvoked);
}
}
}
22 changes: 22 additions & 0 deletions src/Strategy/IRegisterTypeStrategy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using Unity.Lifetime;
using Unity.Registration;

namespace Unity.Strategy
{
public interface IRegisterTypeStrategy
{
/// <summary>
/// Register a type mapping with the container, where the created instances will use
/// the given <see cref="LifetimeManager"/>.
/// </summary>
/// <param name="policies"><see cref="IPolicyList"/> holding the registration.</param>
/// <param name="typeFrom"><see cref="Type"/> that will be requested.</param>
/// <param name="typeTo"><see cref="Type"/> that will actually be returned.</param>
/// <param name="name">Name to use for registration, null if a default registration.</param>
/// <param name="lifetimeManager">The <see cref="LifetimeManager"/> that controls the lifetime
/// of the returned instance.</param>
/// <param name="injectionMembers">Injection configuration objects. Can be null.</param>
void RegisterType(IContainerContext context, Type typeFrom, Type typeTo, string name, LifetimeManager lifetimeManager, params InjectionMember[] injectionMembers);
}
}

0 comments on commit 06e06db

Please sign in to comment.