Example #1
0
        private ClassWithDependancies GetClassWithDependancies()
        {
            ClassWithInterface        classWithInterface        = new ClassWithInterface();
            ClassDependingOnInterface classDependingOnInterface = new ClassDependingOnInterface(classWithInterface);
            ClassWithDependancies     classWithDependancies     = new ClassWithDependancies(classDependingOnInterface);

            return(classWithDependancies);
        }
Example #2
0
 private void ShowDIDemo(IServiceProvider appApplicationServices)
 {
     ClassWithDependancies viaConstructors = this.GetClassWithDependancies();
     //or
     ClassWithDependancies fromDi = appApplicationServices.GetService <ClassWithDependancies>();
 }