internal static SqlUdtInfo GetFromType(Type target) { SqlUdtInfo fromType = TryGetFromType(target); if (fromType == null) { throw new InvalidOperationException("SqlUdtReason_NoUdtAttribute"); } return(fromType); }
internal static SqlUdtInfo TryGetFromType(Type target) { if (types2UdtInfo == null) { types2UdtInfo = new Dictionary<Type, SqlUdtInfo>(); } SqlUdtInfo sqlUdtInfo; if (!types2UdtInfo.TryGetValue(target, out sqlUdtInfo)) { object[] customAttributes = target.GetCustomAttributes(typeof(SqlUserDefinedTypeAttribute), false); if (customAttributes.Length == 1) { sqlUdtInfo = new SqlUdtInfo((SqlUserDefinedTypeAttribute)customAttributes[0]); } types2UdtInfo.Add(target, sqlUdtInfo); } return sqlUdtInfo; }
internal static SqlUdtInfo TryGetFromType(Type target) { if (types2UdtInfo == null) { types2UdtInfo = new Dictionary <Type, SqlUdtInfo>(); } SqlUdtInfo sqlUdtInfo; if (!types2UdtInfo.TryGetValue(target, out sqlUdtInfo)) { object[] customAttributes = target.GetCustomAttributes(typeof(SqlUserDefinedTypeAttribute), false); if (customAttributes.Length == 1) { sqlUdtInfo = new SqlUdtInfo((SqlUserDefinedTypeAttribute)customAttributes[0]); } types2UdtInfo.Add(target, sqlUdtInfo); } return(sqlUdtInfo); }