protected override bool Add(string regName, BasePlugInAttribute attribute, Type type) { Attribute instanceAttr = Attribute.GetCustomAttribute(type, typeof(InstancePlugInAttribute)); if (instanceAttr != null) { BindingFlags flags = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; FieldInfo fieldInfo = type.GetField("Instance", flags); if (fieldInfo == null) { fieldInfo = type.GetField("INSTANCE", flags); if (fieldInfo == null) { return(false); } } object value = ObjectUtil.GetStaticValue(fieldInfo); if (value == null) { return(false); } ICacheDependency dependency = CacheUtil.GetDependency(type, null); if (dependency == null) { dependency = AlwaysDependency.Dependency; } return(AddInstance(regName, attribute, value, dependency) != null); } else { return(base.Add(regName, attribute, type)); } }