-
Notifications
You must be signed in to change notification settings - Fork 406
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #922 from Tom94/prevent-dependency-pollution
Prevent dependency pollution up the scene graph
- Loading branch information
Showing
5 changed files
with
63 additions
and
20 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
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,30 @@ | ||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. | ||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE | ||
|
||
using System; | ||
|
||
namespace osu.Framework.Allocation | ||
{ | ||
/// <summary> | ||
/// Read-only interface into a dependency container capable of injective and retrieving dependencies based | ||
/// on types. | ||
/// </summary> | ||
public interface IReadOnlyDependencyContainer | ||
{ | ||
/// <summary> | ||
/// Retrieves a cached dependency of <paramref name="type"/> if it exists and null otherwise. | ||
/// </summary> | ||
/// <param name="type">The dependency type to query for.</param> | ||
/// <returns>The requested dependency, or null if not found.</returns> | ||
object Get(Type type); | ||
|
||
/// <summary> | ||
/// Injects dependencies into the given instance. | ||
/// </summary> | ||
/// <typeparam name="T">The type of the instance to inject dependencies into.</typeparam> | ||
/// <param name="instance">The instance to inject dependencies into.</param> | ||
/// <param name="autoRegister">True if the instance should be automatically registered as injectable if it isn't already.</param> | ||
/// <param name="lazy">True if the dependencies should be initialized lazily.</param> | ||
void Inject<T>(T instance, bool autoRegister = true, bool lazy = false) where T : class; | ||
} | ||
} |
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