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