Skip to content
This repository was archived by the owner on Oct 20, 2023. It is now read-only.
This repository was archived by the owner on Oct 20, 2023. It is now read-only.

Question about resolving #150

Open
Open
@high1

Description

@high1

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions