1 // Copyright 2004-2007 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
22 /// Represents a delegate which holds basic information about a component.
24 /// <param name="key">Key which identifies the component</param>
25 /// <param name="handler">handler that holds this component and is capable of
26 /// creating an instance of it.
28 public delegate void ComponentDataDelegate( String key
, IHandler handler
);
31 /// Represents a delegate which holds basic information about a component
34 /// <param name="model">Component meta information</param>
35 /// <param name="instance">Component instance</param>
36 public delegate void ComponentInstanceDelegate( ComponentModel model
, object instance
);
39 /// Represents a delegate which holds the information about the
42 public delegate void ComponentModelDelegate( ComponentModel model
);
45 /// Represents a delegate which holds a handler
47 /// <param name="handler">handler that holds a component and is capable of
48 /// creating an instance of it.
50 /// <param name="stateChanged"></param>
51 public delegate void HandlerDelegate( IHandler handler
, ref bool stateChanged
);
54 /// Represents a delegate which holds dependency
55 /// resolving information.
57 public delegate void DependencyDelegate(ComponentModel client
, DependencyModel model
, Object dependency
);
60 /// Summary description for IKernelEvents.
62 public interface IKernelEvents
65 /// Event fired when a new component is registered
68 event ComponentDataDelegate ComponentRegistered
;
71 /// Event fired when a component is removed from the kernel.
73 event ComponentDataDelegate ComponentUnregistered
;
76 /// Event fired after the ComponentModel is created.
77 /// Allows customizations that may affect the handler.
79 event ComponentModelDelegate ComponentModelCreated
;
82 /// Event fired when the kernel was added as child of
85 event EventHandler AddedAsChildKernel
;
88 /// Event fired when the kernel was removed from being a child
89 /// of another kernel.
91 event EventHandler RemovedAsChildKernel
;
94 /// Event fired before the component is created.
96 event ComponentInstanceDelegate ComponentCreated
;
99 /// Event fired when a component instance destroyed.
101 event ComponentInstanceDelegate ComponentDestroyed
;
104 /// Event fired when a new handler is registered
105 /// (it might be in a valid or waiting dependency state)
107 event HandlerDelegate HandlerRegistered
;
110 /// Event fired when a dependency is being resolved,
111 /// it allows the dependency to be changed,
112 /// but the client ComponentModel must not be altered.
114 event DependencyDelegate DependencyResolving
;