コード例 #1
0
        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);
        }
コード例 #2
0
 public HalJsonTypeConfiguration GetOrCreateTypeConfiguration(Type type)
 {
     return(_config.GetOrAdd(type,
                             t => AttributeConfigurationResolver.GetConfigurationOrNull(type) ?? (HalJsonTypeConfiguration)Activator.CreateInstance(typeof(HalJsonTypeConfiguration <>).MakeGenericType(t))));
 }