Ejemplo n.º 1
0
 private static void FillParameters(Database database, string connectionString)
 {
     using (SqlConnection conn = new SqlConnection(connectionString))
     {
         using (SqlCommand command = new SqlCommand(GetSQLParameters(), conn))
         {
             conn.Open();
             command.CommandTimeout = 0;
             using (SqlDataReader reader = command.ExecuteReader())
             {
                 while (reader.Read())
                 {
                     Parameter param = new Parameter();
                     param.Name = reader["Name"].ToString();
                     param.Type = reader["TypeName"].ToString();
                     param.Size = (short)reader["max_length"];
                     param.Scale = (byte)reader["scale"];
                     param.Precision = (byte)reader["precision"];
                     param.Output = (bool)reader["is_output"];
                     if (param.Type.Equals("nchar") || param.Type.Equals("nvarchar"))
                     {
                         if (param.Size != -1)
                             param.Size = param.Size / 2;
                     }
                     database.CLRFunctions[reader["ObjectName"].ToString()].Parameters.Add(param);
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 public CLRFunction(ISchemaBase parent)
     : base(parent, Enums.ObjectType.CLRFunction, Enums.ScripActionType.AddFunction, Enums.ScripActionType.DropFunction)
 {
     parameters = new List<Parameter>();
     returnType = new Parameter();
 }