Community Portal

Rob

Had a weird situation that I need to support for an application but noticed it was not possible in the current version. The issue was that I had a stored procedure that return a record set but also had output parameters. I know it seems strange but unfortunately I don't have a choice.

In order to support that I did the following

1. Inside QueryCommand.cs

public DbCommand DbCommand { get; set; }

2. Inside DBDataProvider.cs

I set the command so I can access it from the stored procedure class.

p ublic IList<T> ToList<T>(QueryCommand qry) where T : new()

       {
           List<T> result = null;
           DbCommand myCommand;
           using (var rdr = ExecuteReader(qry))
           {
               result = rdr.ToList<T>();
               myCommand = qry.DbCommand;
              
           }
           qry.GetOutputParameters(myCommand);
           return result;
       }


3. Then in StoredProcedure.cs

public List<T> ExecuteTypedList<T>() where T : new()

       {
           List<T> myList;
           myList = Provider.ToList<T>(Command) as List<T>;
           this.Output = Command.OutputValues;
           return myList;
       }


Thoughts?


image:Gear.png This article is flagged as incomplete
  • This article needs to be completed by someone in the know!.