How to Execute Storeprocedure

Feb 25, 2015 at 1:46 PM
Edited Feb 25, 2015 at 1: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.
Regards.
Rakesh Kumar Swain
Mar 10, 2015 at 2:57 AM
Edited Mar 10, 2015 at 3: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
Coordinator
May 12, 2015 at 4:53 PM
Marked as answer by lelong37 on 5/12/2015 at 9:53 AM