Updated vs2005 projects for AllTypesOf<> registration updates.
[castle.git] / InversionOfControl / Castle.MicroKernel / Lifestyle / ILifestyleManager.cs
blobaff6d8bd189d8b60f73d552f2d7205b6c793d247
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 /// The <c>ILifestyleManager</c> implements
22 /// a strategy for a given lifestyle, like singleton, perthread
23 /// and transient.
24 /// </summary>
25 /// <remarks>
26 /// The responsability of <c>ILifestyleManager</c>
27 /// is only the management of lifestyle. It should rely on
28 /// <see cref="IComponentActivator"/> to obtain a new component instance
29 /// </remarks>
30 public interface ILifestyleManager : IDisposable
32 /// <summary>
33 /// Initializes the <c>ILifestyleManager</c> with the
34 /// <see cref="IComponentActivator"/>
35 /// </summary>
36 /// <param name="componentActivator"></param>
37 /// <param name="kernel"></param>
38 /// <param name="model"></param>
39 void Init(IComponentActivator componentActivator, IKernel kernel, ComponentModel model);
41 /// <summary>
42 /// Implementors should return the component instance based
43 /// on the lifestyle semantic.
44 /// </summary>
45 /// <returns></returns>
46 object Resolve(CreationContext context);
48 /// <summary>
49 /// Implementors should release the component instance based
50 /// on the lifestyle semantic, for example, singleton components
51 /// should not be released on a call for release, instead they should
52 /// release them when disposed is invoked.
53 /// </summary>
54 /// <param name="instance"></param>
55 void Release(object instance);