Fixing the build, will not add an interceptor twice when it was already added by...
[castle.git] / InversionOfControl / Castle.MicroKernel / IKernelEvents.cs
blob7f5d886ae23b3856fc01356779efb38b873bebab
1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
2 //
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
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
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
17 using System;
18 using Castle.Core;
20 /// <summary>
21 /// Represents a delegate which holds basic information about a component.
22 /// </summary>
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.
26 /// </param>
27 public delegate void ComponentDataDelegate(String key, IHandler handler);
29 /// <summary>
30 /// Represents a delegate which holds basic information about a component
31 /// and its instance.
32 /// </summary>
33 /// <param name="model">Component meta information</param>
34 /// <param name="instance">Component instance</param>
35 public delegate void ComponentInstanceDelegate(ComponentModel model, object instance);
37 /// <summary>
38 /// Represents a delegate which holds the information about the
39 /// component
40 /// </summary>
41 public delegate void ComponentModelDelegate(ComponentModel model);
43 /// <summary>
44 /// Represents a delegate which holds a handler
45 /// </summary>
46 /// <param name="handler">handler that holds a component and is capable of
47 /// creating an instance of it.
48 /// </param>
49 /// <param name="stateChanged"></param>
50 public delegate void HandlerDelegate(IHandler handler, ref bool stateChanged);
52 /// <summary>
53 /// Represents a delegate which holds dependency
54 /// resolving information.
55 /// </summary>
56 public delegate void DependencyDelegate(ComponentModel client, DependencyModel model, Object dependency);
58 /// <summary>
59 /// Summary description for IKernelEvents.
60 /// </summary>
61 public interface IKernelEvents
63 /// <summary>
64 /// Event fired when a new component is registered
65 /// on the kernel.
66 /// </summary>
67 event ComponentDataDelegate ComponentRegistered;
69 /// <summary>
70 /// Event fired when a component is removed from the kernel.
71 /// </summary>
72 event ComponentDataDelegate ComponentUnregistered;
74 /// <summary>
75 /// Event fired after the ComponentModel is created.
76 /// Allows customizations that may affect the handler.
77 /// </summary>
78 event ComponentModelDelegate ComponentModelCreated;
80 /// <summary>
81 /// Event fired when the kernel was added as child of
82 /// another kernel.
83 /// </summary>
84 event EventHandler AddedAsChildKernel;
86 /// <summary>
87 /// Event fired when the kernel was removed from being a child
88 /// of another kernel.
89 /// </summary>
90 event EventHandler RemovedAsChildKernel;
92 /// <summary>
93 /// Event fired before the component is created.
94 /// </summary>
95 event ComponentInstanceDelegate ComponentCreated;
97 /// <summary>
98 /// Event fired when a component instance destroyed.
99 /// </summary>
100 event ComponentInstanceDelegate ComponentDestroyed;
102 /// <summary>
103 /// Event fired when a new handler is registered
104 /// (it might be in a valid or waiting dependency state)
105 /// </summary>
106 event HandlerDelegate HandlerRegistered;
108 /// <summary>
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.
112 /// </summary>
113 event DependencyDelegate DependencyResolving;