Base solution for your next web application
Open Closed

Calling Sql Stored Procedure with custom repository #7337


User avatar
0
Riaan.Smit created

Hi, I'm trying to call Sql SP's and followed the advice given in a previous question (https://support.aspnetzero.com/QA/Questions/2723#answer-9f3213f6-db7e-4866-9bbc-61c5cf17059d). However, in the example, the custom repository is created based on a concrete entity (db table - User). The SP's I need to call are all for reporting purposes, so none of the returned entities will have primary keys, and there is no need for entity tracking and the like. I created a dummy class with an id field for creating the repo's, specifically to inherit from ...RepositoryBase, but I'm sure there is a better way of doing it. Any advice will be greatly appreciated.

Regards, Riaan


2 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    You can inject the IActiveTransactionProvider interface into a separate class, then get the Connection and Transaction to execute the sql stored procedure instead of using the custom repository.

  • User Avatar
    0
    Riaan.Smit created

    That you so much for the help. Your answer resolved my issue.