Paolo ponzano - 341 - Dec 13, 2013

Hello to everybody… I was wondering how to use the  dbConn.SqlProcedure item… in v3 I was using

   string sp = “SOME_SP”

                var dataTable = dbConn.StoredProcedureList<myPOCO>(sp,
                    new
                    {
                        /params/
                    });

Now with  dbConn.SqlProcedure I only have an anon …no SP name to call… I don’t use T4 class file…what have I to do? Thanks

Joe Kampschmidt:

have you tried creating a class that has an alias attribute like [Alias(“usp_sproc”)] and provide that as your object to SqlProcedure?

paolo ponzano:

Hello Joe,
my class has the alias defined for the coumns …

   internal class myPOCO
    {
        [Alias(“ID_A”)]
        public int id_a { get; set; }
               [Alias(“ID_B”)]
        public int id_b { get; set; }
    }

where should I put it? on the class?
Thanks

Joe Kampschmidt:

Sounds like in your case you should have a class to represent the procedure and its parameters. Then another to represent the DTO or results returned. Try putting the alias attribute on the procedure class.

paolo ponzano:

I don’t like this approach a lot (to be sincere), I currently retrieve the sp name from a xml file(this for switching the sp name without recompile the whole app) and I can’t do this anymore putting it on the top… can I ask for a request to add an overload?