Added RedirectUsingNamedRoute
[castle.git] / InversionOfControl / Castle.MicroKernel / Registration / AbstractPropertyDescriptor.cs
blob74a07cfddad9f0b4cb91b219edfb1ef03c0937b6
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.Registration
17 using System;
18 using System.Collections;
19 using Core;
21 public abstract class AbstractPropertyDescriptor<S> : ComponentDescriptor<S>
23 private readonly Property[] properties;
24 private readonly IDictionary dictionary;
26 protected AbstractPropertyDescriptor(params Property[] properties)
28 this.properties = properties;
31 protected AbstractPropertyDescriptor(IDictionary dictionary)
33 this.dictionary = dictionary;
36 protected internal override void ApplyToModel(IKernel kernel, ComponentModel model)
38 if (dictionary != null)
40 foreach(DictionaryEntry property in dictionary)
42 ApplyProperty(kernel, model, property.Key.ToString(), property.Value, null);
45 else if (properties != null)
47 foreach(Property property in properties)
49 ApplyProperty(kernel, model, property.Key, property.Value, property);
54 protected abstract void ApplyProperty(IKernel kernel, ComponentModel model,
55 String key, Object value, Property property);