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
21 /// Represents a delegate which holds basic information about a component.
23 /// <param name="key">Key which identifies the component</param>
24 /// <param name="handler">handler that holds this component and is capable of
25 /// creating an instance of it.
27 public delegate void ComponentDataDelegate(String key
, IHandler handler
);
30 /// Represents a delegate which holds basic information about a component
33 /// <param name="model">Component meta information</param>
34 /// <param name="instance">Component instance</param>
35 public delegate void ComponentInstanceDelegate(ComponentModel model
, object instance
);
38 /// Represents a delegate which holds the information about the
41 public delegate void ComponentModelDelegate(ComponentModel model
);
44 /// Represents a delegate which holds a handler
46 /// <param name="handler">handler that holds a component and is capable of
47 /// creating an instance of it.
49 /// <param name="stateChanged"></param>
50 public delegate void HandlerDelegate(IHandler handler
, ref bool stateChanged
);
53 /// Represents a delegate which holds dependency
54 /// resolving information.
56 public delegate void DependencyDelegate(ComponentModel client
, DependencyModel model
, Object dependency
);
59 /// Summary description for IKernelEvents.
61 public interface IKernelEvents
64 /// Event fired when a new component is registered
67 event ComponentDataDelegate ComponentRegistered
;
70 /// Event fired when a component is removed from the kernel.
72 event ComponentDataDelegate ComponentUnregistered
;
75 /// Event fired after the ComponentModel is created.
76 /// Allows customizations that may affect the handler.
78 event ComponentModelDelegate ComponentModelCreated
;
81 /// Event fired when the kernel was added as child of
84 event EventHandler AddedAsChildKernel
;
87 /// Event fired when the kernel was removed from being a child
88 /// of another kernel.
90 event EventHandler RemovedAsChildKernel
;
93 /// Event fired before the component is created.
95 event ComponentInstanceDelegate ComponentCreated
;
98 /// Event fired when a component instance destroyed.
100 event ComponentInstanceDelegate ComponentDestroyed
;
103 /// Event fired when a new handler is registered
104 /// (it might be in a valid or waiting dependency state)
106 event HandlerDelegate HandlerRegistered
;
109 /// Event fired when a dependency is being resolved,
110 /// it allows the dependency to be changed,
111 /// but the client ComponentModel must not be altered.
113 event DependencyDelegate DependencyResolving
;