public string GetKeyForType(Type type) { if (IsGenericCollection(type)) { return type.Namespace + "." + type.Name; } if (type.IsArray && !(type.GetElementType().IsValueType || type.GetElementType() == typeof (string))) { return "System.Array"; } return type.GetProxiedTypeFullName(); }
private INakedObjectSpecification LoadSpecificationAndCache(Type type) { string proxiedTypeName = type.GetProxiedTypeFullName(); TypeUtils.GetType(type.FullName); // This should ensure type is cached lock (cache) { // this is a double check on the cache to check it was not written to during the unguarded // internal between the last check and the lock INakedObjectSpecification specification = Cache.GetSpecification(proxiedTypeName); if (specification != null) { return specification; } specification = CreateSpecification(type); if (specification == null) { throw new ReflectionException("unrecognised class " + proxiedTypeName); } // we need the specification available in cache even though not yet full introspected // need to be careful no other thread reads until introspected Cache.Cache(proxiedTypeName, specification); var introspectableSpecification = specification as IIntrospectableSpecification; if (introspectableSpecification != null) { introspectableSpecification.Introspect(facetDecorator); if (!installingServices) { introspectableSpecification.PopulateAssociatedActions( NakedObjectsContext.ObjectPersistor.GetServices(ServiceTypes.Menu | ServiceTypes.Contributor)); } } return specification; } }
public virtual void InstallServiceSpecification(Type type) { INakedObjectSpecification spec = Cache.GetSpecification(type.GetProxiedTypeFullName()); if (spec != null) { return; } NakedObjectSpecificationAbstract specification = Install(type); Cache.Cache(type.GetProxiedTypeFullName(), specification); specification.Introspect(facetDecorator); specification.MarkAsService(); }
public static string GetObjectType(Type type) { return type.GetProxiedTypeFullName().Replace('.', '-'); }