I'm using a Unity container to load up my types and wire up my interfaces.
for example:
// type registrations
container
.RegisterType(typeof(Startup))
.RegisterType<IUserProfileHelper, UserProfileHelper>()
.RegisterType<IUserSecurityManager, UserSecurityManager>()
.RegisterType(typeof(IDog), typeof(Dog))
.RegisterType(typeof(ICat), typeof(Cat))
However, Cat requires Meow:
public Class Cat
{
public Cat(Meow meow)
{
}
}
Where Meow is a DTO:
public class Meow
{
public int Becibals {get;set;}
public bool Scratchy {get;set;}
//etc
}
If a client populates the class Meow during runtime, how do I inject Meow into my container?
If you believe this is a code smell please let me know an alternative pattern to use.
Please note that during runtime, we are outside the scope of when the types are being registered. So perhaps I would need to change the Cat class to not have a constructor at all?