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?
can inject one? how , lifecycle?
should use "using (..."?
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
Post a Comment