running stored procedures into own model with servicestack ormlite

Viewed 7449

Is there any examples to be found for running a stored procedure on serviceStack MVC using ormlite? mythz ? seen this block of code:

var results = new List<EnergyCompare>
                    {dbFactory.Exec(dbCmd =>
                       {
                          dbCmd.CommandType = CommandType.StoredProcedure;
                          dbCmd.Parameters.Add(new SqlParameter("@id", 1));
                          dbCmd.CommandText = "GetAuthorById";
                          return dbCmd.ExecuteReader().ConvertTo<EnergyCompare>();
                       }
                    )};

but came with the text of never worked on the google groups!

i can also write this:

using(var db = new SwitchWizardDb())
            {
             var results2 = db.dbCmd.ExecuteProcedure()   
            }

but not sure how to complete this with parameters, and in the source code I looked at, it said obsolete?

thanks

4 Answers
Related