How to Execute Storeprocedure

Feb 25, 2015 at 2:46 PM
Edited Feb 25, 2015 at 2:53 PM
Hi All,

I want to get a resultset from stored procedure .how i ll pass the parameter and call the stored procedure to get the resultset through this repository pattern.

Business Layer
public interface IAdminService
    object GetDashboardRecCount();
public class AdminService:IAdminService
    public AdminService()

    public object GetDashboardRecCount()
        //here i want to call the procedure.
Thank you in advance.
Rakesh Kumar Swain
Mar 10, 2015 at 3:57 AM
Edited Mar 10, 2015 at 4:05 AM
If your storedprocedure returns an object graph that can be mapped to an Admin Entity then, something like ....
var adminRepository = {however you wish to create the repository ....}
var adminEntity = adminRepository.SqlQuery("dbo.GetAdminById @p0", adminId).Single();
There is a good article about it here: StoredProcedureWithServicePatternExample
May 12, 2015 at 5:53 PM
Marked as answer by lelong37 on 5/12/2015 at 9:53 AM