public void CreateInstanceFromCachedFactory() { CustomClass instance = _cachedFactory.Invoke(_sp, new object[] { nameof(CreateInstanceFromCachedFactory) }) as CustomClass; }
public void CreateFactoryGeneric() { CustomClass instance = CreateGenericFactory <CustomClass>(nameof(CreateFactoryGeneric)); }
public void CreateInstance() { CustomClass instance = ActivatorUtilities.CreateInstance <CustomClass>(_sp, new[] { nameof(CreateInstance) }); }
public void CreateFactory() { var factory = ActivatorUtilities.CreateFactory(typeof(CustomClass), new Type[] { typeof(string) }); CustomClass instance = factory.Invoke(_sp, new object[] { nameof(CreateFactory) }) as CustomClass; }
public void CreateInstanceManually() { var svc = _sp.GetService <RegisteredClass1>(); CustomClass instance = new CustomClass(svc, nameof(CreateInstanceManually)); }