private static void RegisterType(IType nhibernateType, IEnumerable <string> aliases, GetNullableTypeWithLengthOrScale ctorLengthOrScale) { var typeAliases = new List <string>(aliases) { nhibernateType.Name }; foreach (var alias in typeAliases) { RegisterTypeAlias(nhibernateType, alias); if (!_getTypeDelegatesWithLengthOrScale.TryAdd(alias, ctorLengthOrScale)) { throw new HibernateException("An item with the same key has already been added to getTypeDelegatesWithLength."); } } }
private static NullableType GetType(NullableType defaultUnqualifiedType, int lengthOrScale, GetNullableTypeWithLengthOrScale ctorDelegate) { var key = GetKeyForLengthOrScaleBased(defaultUnqualifiedType.Name, lengthOrScale); return((NullableType)typeByTypeOfName.GetOrAdd(key, k => ctorDelegate(lengthOrScale))); }