1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle
.MicroKernel
20 /// Implementors should use a strategy to obtain
21 /// valid references to properties and/or services
22 /// requested in the dependency model.
24 public interface ISubDependencyResolver
27 /// Should return an instance of a service or property values as
28 /// specified by the dependency model instance.
29 /// It is also the responsability of <see cref="IDependencyResolver"/>
30 /// to throw an exception in the case a non-optional dependency
31 /// could not be resolved.
33 /// <param name="context">Creation context, which is a resolver itself</param>
34 /// <param name="parentResolver">Parent resolver</param>
35 /// <param name="model">Model of the component that is requesting the dependency</param>
36 /// <param name="dependency">The dependency model</param>
37 /// <returns>The dependency resolved value or null</returns>
38 object Resolve(CreationContext context
, ISubDependencyResolver parentResolver
, ComponentModel model
, DependencyModel dependency
);
41 /// Returns true if the resolver is able to satisfy this dependency.
43 /// <param name="context">Creation context, which is a resolver itself</param>
44 /// <param name="parentResolver">Parent resolver</param>
45 /// <param name="model">Model of the component that is requesting the dependency</param>
46 /// <param name="dependency">The dependency model</param>
47 /// <returns><c>true</c> if the dependency can be satisfied</returns>
48 bool CanResolve(CreationContext context
, ISubDependencyResolver parentResolver
, ComponentModel model
, DependencyModel dependency
);