Base solution for your next web application
Open Closed

When dependency injection is not possible, am I OK doing this? #8568


User avatar
0
dev1_premierpoint created

In a class in my app that can't use dependency injection (class can't inherit from an Abp base class and can't have a parameterized constructor), are there any "gotchas" if I do this?:

        ITenantCache tenantCache = Abp.Dependency.SingletonDependency<ITenantCache>.Instance;

1 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    This is not friendly to unit tests. It is equivalent to using the global IocManager.