Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Stored procedure call from within the Services. #3144


User avatar
0
vnetonline created

Hi.

Just needed to call a stored procedure from within the AppService. I had a look at this page,

#3001@1ae4525e-277b-4e15-9771-14ec911be476

but it still isn't very clear as to how to implement this. Your help would be much appreciated.

Thinking of doing something on these lines

    public async System.Threading.Tasks.Task<System.Collections.Generic.List<int>> CallStoreProc()
    {
        return await Context.Database.SqlQuery<int>("get_id_of_customer").SingleAsync();
    }

Regards


3 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    In order to access DbContext, first you need to create a custom repository. You can check this document for doing that <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/Repositories#custom-repositories">https://aspnetboilerplate.com/Pages/Doc ... positories</a>.

    If you already done that, can you share your code, so we can help you ?

    Thanks.

  • User Avatar
    0
    vnetonline created

    Thanks. Works perfectly!!

  • User Avatar
    0
    ismcagdas created
    Support Team

    Great :)