1
+ // -------------------------------------------------------------------------------------------------
2
+ // <copyright file="IResolutionRoot.cs" company="Ninject Project Contributors">
3
+ // Copyright (c) 2007-2010 Enkari, Ltd. All rights reserved.
4
+ // Copyright (c) 2010-2020 Ninject Project Contributors. All rights reserved.
5
+ //
6
+ // Dual-licensed under the Apache License, Version 2.0, and the Microsoft Public License (Ms-PL).
7
+ // You may not use this file except in compliance with one of the Licenses.
8
+ // You may obtain a copy of the License at
9
+ //
10
+ // http://www.apache.org/licenses/LICENSE-2.0
11
+ // or
12
+ // http://www.microsoft.com/opensource/licenses.mspx
13
+ //
14
+ // Unless required by applicable law or agreed to in writing, software
15
+ // distributed under the License is distributed on an "AS IS" BASIS,
16
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ // See the License for the specific language governing permissions and
18
+ // limitations under the License.
19
+ // </copyright>
20
+ // -------------------------------------------------------------------------------------------------
21
+
22
+ namespace Ninject . Syntax
23
+ {
24
+ using System ;
25
+ using System . Collections . Generic ;
26
+
27
+ using Ninject . Activation ;
28
+ using Ninject . Parameters ;
29
+ using Ninject . Planning . Bindings ;
30
+
31
+ /// <summary>Provides a path to resolve instances.</summary>
32
+ public interface IResolutionRoot : IFluentSyntax
33
+ {
34
+ /// <summary>Injects the specified existing instance, without managing its lifecycle.</summary>
35
+ void Inject ( object instance , params IParameter [ ] parameters ) ;
36
+
37
+ /// <summary>Determines whether the specified request can be resolved.</summary>
38
+ bool CanResolve ( IRequest request ) ;
39
+
40
+ /// <summary>Determines whether the specified request can be resolved.</summary>
41
+ bool CanResolve ( IRequest request , bool ignoreImplicitBindings ) ;
42
+
43
+ /// <summary>Resolves instances for the specified request. The instances are not actually resolved
44
+ /// until a consumer iterates over the enumerator.</summary>
45
+ IEnumerable < object > Resolve ( IRequest request ) ;
46
+
47
+ /// <summary>Resolves an instance for the specified request.</summary>
48
+ object ResolveSingle ( IRequest request ) ;
49
+
50
+ /// <summary>Creates a request for the specified service.</summary>
51
+ /// <param name="service">The service that is being requested.</param>
52
+ /// <param name="constraint">The constraint to apply to the bindings to determine if they match the request.</param>
53
+ /// <param name="parameters">The parameters to pass to the resolution.</param>
54
+ /// <param name="isOptional"><see langword="true"/> if the request is optional; otherwise, <see langword="false"/>.</param>
55
+ /// <param name="isUnique"><see langword="true"/> if the request should return a unique result; otherwise, <see langword="false"/>.</param>
56
+ /// <returns>The request for the specified service.</returns>
57
+ IRequest CreateRequest ( Type service , Func < IBindingMetadata , bool > constraint , IReadOnlyList < IParameter > parameters , bool isOptional , bool isUnique ) ;
58
+
59
+ /// <summary>Deactivates and releases the specified instance if it is currently managed by Ninject.</summary>
60
+ bool Release ( object instance ) ;
61
+ }
62
+
63
+ /// <summary>The marker</summary>
64
+ public interface IFluentSyntax { }
65
+ }
66
+
67
+ namespace Ninject . Parameters
68
+ {
69
+ using System ;
70
+
71
+ using Ninject . Activation ;
72
+ using Ninject . Planning . Targets ;
73
+
74
+ /// <summary>Modifies an activation process in some way.</summary>
75
+ public interface IParameter : IEquatable < IParameter >
76
+ {
77
+ /// <summary>Gets the name of the parameter.</summary>
78
+ string Name { get ; }
79
+
80
+ /// <summary>Gets a value indicating whether the parameter should be inherited into child requests.</summary>
81
+ bool ShouldInherit { get ; }
82
+
83
+ /// <summary>Gets the value for the parameter within the specified context.</summary>
84
+ object GetValue ( IContext context , ITarget target ) ;
85
+ }
86
+ }
0 commit comments