You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 20, 2023. It is now read-only.
I have a project in which I used Singularity, and it has a very simple setup -| builder.Register<Configuration>(conf => conf.With(Lifetimes.PerContainer)); builder.Register<IConnectionFactory, ConnectionFactory>();
which is resolved in a final class - public Service(DatabaseHandler dbHandler, RemoteDatabaseHandler remoteDbHandler, Server server, Publisher publisher, Router router, ServiceMessagePump messagePump, Configuration configuration) and everything works.
Looking at the documentation, I though that this should also work - public Service(Func<string, DatabaseHandler> dbHandlerFactory, RemoteDatabaseHandler remoteDbHandler, Server server, Publisher publisher, Router router, ServiceMessagePump messagePump, Configuration configuration) but this does not work, because Singularity is not able to resolve DatabaseHandler. This is it's constructor which works public DatabaseHandler(IConnectionFactory factory) - and I though that if I change it like public DatabaseHandler(IConnectionFactory factory, string connectionType) I could resolve it like Func<string, DatabaseHandler> and then get an instance like DatabaseHandler = dbHandlerFactory("some string...").
Should this work or are my assumptions wrong?
Thanks.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I have a project in which I used Singularity, and it has a very simple setup -|
builder.Register<Configuration>(conf => conf.With(Lifetimes.PerContainer)); builder.Register<IConnectionFactory, ConnectionFactory>();
which is resolved in a final class -
public Service(DatabaseHandler dbHandler, RemoteDatabaseHandler remoteDbHandler, Server server, Publisher publisher, Router router, ServiceMessagePump messagePump, Configuration configuration)
and everything works.Looking at the documentation, I though that this should also work -
public Service(Func<string, DatabaseHandler> dbHandlerFactory, RemoteDatabaseHandler remoteDbHandler, Server server, Publisher publisher, Router router, ServiceMessagePump messagePump, Configuration configuration)
but this does not work, because Singularity is not able to resolve DatabaseHandler. This is it's constructor which workspublic DatabaseHandler(IConnectionFactory factory)
- and I though that if I change it likepublic DatabaseHandler(IConnectionFactory factory, string connectionType)
I could resolve it likeFunc<string, DatabaseHandler>
and then get an instance like DatabaseHandler = dbHandlerFactory("some string...").Should this work or are my assumptions wrong?
Thanks.
The text was updated successfully, but these errors were encountered: