ServiceOverride
Represents a service override.
using System;
namespace Castle.MicroKernel.Registration
{
public class ServiceOverride
{
public object DependencyKey { get; set; }
public Type Type { get; set; }
public object Value { get; set; }
internal ServiceOverride(object dependencyKey, object value)
: this(dependencyKey, value, null)
{
}
internal ServiceOverride(object dependencyKey, object value, Type type)
{
DependencyKey = dependencyKey;
Value = value;
Type = type;
}
public static ServiceOverrideKey ForKey(string key)
{
return new ServiceOverrideKey(key);
}
public static ServiceOverrideKey ForKey(Type key)
{
return new ServiceOverrideKey(key);
}
public static ServiceOverrideKey ForKey<TKey>()
{
return new ServiceOverrideKey(typeof(TKey));
}
public static implicit operator Dependency(ServiceOverride item)
{
if (item != null)
return new Dependency(item);
return null;
}
}
}