Is Func appropriate to use as a ctor arg when applying Dependency Injection?

前端 未结 7 529
没有蜡笔的小新
没有蜡笔的小新 2021-01-31 12:09

Example:

public class BusinessTransactionFactory  where T : IBusinessTransaction
{
    readonly Func _createTransactio         


        
7条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-31 12:30

    IF you inject Func I thin the code will be lazy, so in some case if you class depends from lots of other dependencies maybe is beter to inject Funct in that case. Im I right.

    Sorry for my bad english

提交回复
热议问题