Is there a way I can share dependencies between a validator and a service? In particular an IDbConnection.
Currently I'm injecting a IDbConnectionFactory into my validator then lazy loading an IDbConnection, like
Service does. However the validator doesn't get disposed until the service does, so that connection hangs around.
Is there a way I can share the connection? (Maybe by resolving it differently in the validator?) Or can the validator be disposed sooner?
There's no way to share dependency instances across logic classes, tho it shouldn't matter if your DB connection is using a connection pool.
If your validator implements
IDisposable then it should now be disposed after usage from this commit.
This change is available from v4.0.49 that's now available on MyGet.