Exemplo n.º 1
0
        public static SqlType Resolve(SqlTypeCode typeCode, string typeName, DataTypeMeta[] metadata, ITypeResolver resolver)
        {
            if (PrimitiveTypes.IsPrimitive(typeCode))
            {
                return(PrimitiveTypes.Resolve(typeCode, typeName, metadata));
            }

            if (resolver == null)
            {
                throw new NotSupportedException(String.Format("Cannot resolve type '{0}' without context.", typeName));
            }

            var resolveCcontext = new TypeResolveContext(typeCode, typeName, metadata);

            return(resolver.ResolveType(resolveCcontext));
        }
Exemplo n.º 2
0
        public static SqlType ResolveType(this IContext context, string typeName, params DataTypeMeta[] meta)
        {
            if (PrimitiveTypes.IsPrimitive(typeName))
            {
                return(PrimitiveTypes.Resolve(typeName, meta));
            }

            var resolvers = context.ResolveAllServices <ITypeResolver>();

            foreach (var resolver in resolvers)
            {
                var sqlType = resolver.ResolveType(new TypeResolveContext(SqlTypeCode.Unknown, typeName, meta));
                if (sqlType != null)
                {
                    return(sqlType);
                }
            }

            return(null);
        }
Exemplo n.º 3
0
 public static bool IsPrimitiveType(SqlTypeCode typeCode)
 {
     return(PrimitiveTypes.IsPrimitive(typeCode));
 }