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
I'm trying to set up a call to .with() when registering a type with an existing instance of an object, following the sample on the Hypodermic github site, as shown below. The .with() executes without incident, but it does not wire up the dependency in the parent object, which is left empty. According to the docs, it seems this should work. Is there something I'm doing wrong?
class IFoo
{
public:
virtual void Bar() = 0;
};
class Foo : public IFoo
{
public:
virtual void Bar() override {};
};
class IBaz { };
class Baz : public IBaz
{
public:
Baz(std::shared_ptr foo) : m_pFoo(foo) {};
std::shared_ptr m_pFoo;
};
Hypodermic::ContainerBuilder builder;
auto foo = std::make_shared(); builder.registerType() .with(foo) .as();
builder.build();
auto pBaz = pContainer->resolve();
The text was updated successfully, but these errors were encountered:
I'm trying to set up a call to .with() when registering a type with an existing instance of an object, following the sample on the Hypodermic github site, as shown below. The .with() executes without incident, but it does not wire up the dependency in the parent object, which is left empty. According to the docs, it seems this should work. Is there something I'm doing wrong?
class IFoo
{
public:
virtual void Bar() = 0;
};
class Foo : public IFoo
{
public:
virtual void Bar() override {};
};
class IBaz { };
class Baz : public IBaz
{
public:
Baz(std::shared_ptr foo) : m_pFoo(foo) {};
std::shared_ptr m_pFoo;
};
Hypodermic::ContainerBuilder builder;
auto foo = std::make_shared();
builder.registerType() .with(foo) .as();
builder.build();
auto pBaz = pContainer->resolve();
The text was updated successfully, but these errors were encountered: