File tree Expand file tree Collapse file tree
LessonsSamples/LessonsSamples/Lesson6/DI-Demo Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ namespace LessonsSamples.Lesson6
55 public interface IMovieConsoleCreator
66 {
77 void Open ( ) ;
8-
98 }
109
1110 class MovieConsoleCreator : IMovieConsoleCreator
Original file line number Diff line number Diff line change @@ -19,11 +19,10 @@ private static void ConfigureServices(ServiceCollection services)
1919 services
2020 . AddTransient < IMovieConsoleCreator , MovieConsoleCreator > ( )
2121 . AddTransient < IMovieTranslator , MovieTranslator > ( )
22- . AddTransient < ITextStorage , FileStorage > ( )
22+ . AddScoped < ITextStorage , FileStorage > ( )
2323
2424 // Demo the difference between Scoped and Transient. This being the root container, Scoped will be promoted to Singleton
2525 . AddTransient < MovieConsoleApplication , MovieConsoleApplication > ( )
26-
2726 ;
2827 }
2928 }
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ public static void MainFunc()
1313 container . RegisterType < IMovieTranslator , MovieTranslator > ( ) ;
1414
1515 // Demo the difference between PerResolveLifetimeManager and TransientLifetimeManager
16- container . RegisterType < ITextStorage , FileStorage > ( new TransientLifetimeManager ( ) ) ;
16+ container . RegisterType < ITextStorage , FileStorage > ( new PerResolveLifetimeManager ( ) ) ;
1717
1818
1919 var app = container . Resolve < MovieConsoleApplication > ( ) ;
You can’t perform that action at this time.
0 commit comments