c# - Use a IDBConnection in a service -


on mvc project have service layer commands , queries.

in of these commands , queries use dapper needs connection.

public class getpostsstatsquery {    public getpostsstatsquery() {   }    public poststats execute() {      // code here   } } 

what options have create connection , use in dapper query?

  1. can inject one? how , lifecycle?

  2. should use "using (..."?

  3. any other option?

any of options fine, just other option (for example, connection-factory). entirely implementation detail, , should driven other requirements. there no single "right answer" here.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

django - CSRF verification failed. Request aborted. CSRF cookie not set -