Пример #1
0
 public ProcComposer(SqlConnection sqlConnection, ProcIdentifier procIdentifier, string outputFolder)
 {
     _sqlConnection  = sqlConnection;
     _procIdentifier = procIdentifier;
     _namespace      = CommandLineParser.Request.NameSpace;
     _fileName       = Path.Join(outputFolder, $@"{_procIdentifier.Schema}.{_procIdentifier.Name}.cs");
 }
Пример #2
0
        public ProcDefinition ParseProc(ProcIdentifier procIdentifier)
        {
            var procDefinition = new ProcDefinition(procIdentifier);

            ReadBasicParameterDefinition(procIdentifier, procDefinition);
            ParseParameterDefaults(procDefinition);
            procDefinition.SortParametersRequriedFirst();
            Log(procDefinition);
            return(procDefinition);
        }
Пример #3
0
 private void ReadBasicParameterDefinition(ProcIdentifier procIdentifier, ProcDefinition procDefinition)
 {
     using (var dataReader = new Procs.Dbo.sp_procedure_params_rowset(
                procIdentifier.Name,
                procedure_schema: procIdentifier.Schema)
                             .SetConnection(_sqlConnection)
                             .ExecuteDataReader())
     {
         while (dataReader.Read())
         {
             var name          = dataReader["PARAMETER_NAME"].ToString();
             var sqlType       = dataReader["TYPE_NAME"].ToString();
             var originalOrder = dataReader.GetInt16(dataReader.GetOrdinal("ORDINAL_POSITION")) - 1;
             procDefinition.Parameters.Add(new ParameterDefinition(name, sqlType, originalOrder));
         }
     }
 }
Пример #4
0
 public ProcDefinition(ProcIdentifier procIdentifier)
 {
     Identifier = procIdentifier;
     Parameters = new List <ParameterDefinition>();
 }