C# - Trying not to repeat initializing child external dependencies with parents



Let's say you have a parent which uses dependencies like so,




And you also noticed we have an interface called 'IDropEndpoint'. Let's say this dependencies also uses whatever the parent uses, in this case ISession and IEndpoint.


It is common to use DI, to bind all these together. But instead of doing this, would it be easier to have a method that accepts ISession and IEndpoint instead?




No complexity and code repeat.






Comments

Popular posts from this blog

The specified initialization vector (IV) does not match the block size for this algorithm