public bool TryGetTypeConfiguration(Type type, out HalJsonTypeConfiguration config) { var rv = _config.TryGet(type, out config); if (!rv && AttributeConfigurationResolver.GetConfigurationOrNull(type) != null) // No configuration in cache, but found attribute-based one { config = GetOrCreateTypeConfiguration(type); return(true); } return(rv); }
public HalJsonTypeConfiguration GetOrCreateTypeConfiguration(Type type) { return(_config.GetOrAdd(type, t => AttributeConfigurationResolver.GetConfigurationOrNull(type) ?? (HalJsonTypeConfiguration)Activator.CreateInstance(typeof(HalJsonTypeConfiguration <>).MakeGenericType(t)))); }