Exemplo n.º 1
0
        static List <IndigoSQLFunction> GenerateFunctions(IEnumerable <MethodInfo> methods)
        {
            List <IndigoSQLFunction> functions = new List <IndigoSQLFunction>();

            foreach (MethodInfo m in methods)
            {
                IndigoSQLFunction f = new IndigoSQLFunction();
                f.comment = m.Name;

                object[] attributes            = m.GetCustomAttributes(typeof(BingoSqlFunctionAttribute), true);
                BingoSqlFunctionAttribute attr = (BingoSqlFunctionAttribute)(attributes[0]);

                IndigoSQLFunctionInfo mf = f.main_function;
                mf.name         = String.Format("[$(bingo)].z_{0}", m.Name);
                mf.ret_type     = SqlType(m.ReturnType.Name, m);
                mf.access_level = attr.access_level;
                foreach (ParameterInfo p in m.GetParameters())
                {
                    mf.arguments.Add(new KeyValuePair <string, string>(p.Name, SqlType(p.ParameterType.Name, m)));
                }

                mf.code = String.Format("  EXTERNAL NAME [$(bingo)_assembly].[{0}].{1}",
                                        m.ReflectedType.FullName, m.Name);

                // Create wrappers
                f.wrappers.Add(CreateWrapper(mf, false, m));
                if (attr.str_bin != null)
                {
                    f.wrappers.Add(CreateWrapper(mf, true, m));
                }

                functions.Add(f);
            }

            return(functions);
        }
Exemplo n.º 2
0
      static List<IndigoSQLFunction> GenerateFunctions (IEnumerable<MethodInfo> methods)
      {
         List<IndigoSQLFunction> functions = new List<IndigoSQLFunction>();

         foreach (MethodInfo m in methods)
         {
            IndigoSQLFunction f = new IndigoSQLFunction();
            f.comment = m.Name;

            object[] attributes = m.GetCustomAttributes(typeof(BingoSqlFunctionAttribute), true);
            BingoSqlFunctionAttribute attr = (BingoSqlFunctionAttribute)(attributes[0]);

            IndigoSQLFunctionInfo mf = f.main_function;
            mf.name = String.Format("[$(bingo)].z_{0}", m.Name);
            mf.ret_type = SqlType(m.ReturnType.Name, m);
            mf.access_level = attr.access_level;
            foreach (ParameterInfo p in m.GetParameters())
               mf.arguments.Add(new KeyValuePair<string,string>(p.Name, SqlType(p.ParameterType.Name, m)));

            mf.code = String.Format("  EXTERNAL NAME [$(bingo)_assembly].[{0}].{1}",
               m.ReflectedType.FullName, m.Name);

            // Create wrappers
            f.wrappers.Add(CreateWrapper(mf, false, m)); 
            if (attr.str_bin != null)
               f.wrappers.Add(CreateWrapper(mf, true, m)); 

            functions.Add(f);
         }

         return functions;
      }