@@ -188,6 +188,7 @@ partial class Composition: IDisposable
188188 private object [] _disposables ;
189189 private int _disposeIndex ;
190190
191+ private Program ? _singletonProgram58 ;
191192 private Microsoft .Extensions .Logging .ILogger ? _singletonILogger55 ;
192193 private Func <Student , Person >? _singletonFunc59 ;
193194 private AutoMapper .Mapper ? _singletonMapper56 ;
@@ -214,50 +215,55 @@ partial class Composition: IDisposable
214215 [MethodImpl (MethodImplOptions .AggressiveInlining )]
215216 get
216217 {
217- if (_root ._singletonFunc59 is null )
218+ if (_root ._singletonProgram58 is null )
218219 lock (_lock )
219- if (_root ._singletonFunc59 is null )
220+ if (_root ._singletonProgram58 is null )
220221 {
221- _root ._singletonFunc59 = source =>
222- {
223- if (_root ._singletonMapper56 is null )
224- {
225- EnsureLoggerFactoryExists ();
226- LoggerFactory localLoggerFactory = _root ._singletonLoggerFactory54 ;
227- // Create the mapping configuration
228- var localConfiguration = new MapperConfiguration (cfg =>
222+ if (_root ._singletonFunc59 is null )
223+ lock (_lock )
224+ if (_root ._singletonFunc59 is null )
229225 {
230- cfg .CreateMap <Student , Person >();
231- }, localLoggerFactory );
232- localConfiguration .CompileMappings ();
233- // Create the mapper
234- _root ._singletonMapper56 = new Mapper (localConfiguration );
235- }
236-
237- AutoMapper .IMapper localMapper = _root ._singletonMapper56 ;
238- // source -> target
239- Person localTarget = localMapper .Map <Student , Person >(source );
240- // Building-up a mapped value with dependencies
241- if (_root ._singletonPersonFormatter53 is null )
242- {
243- _root ._singletonPersonFormatter53 = new PersonFormatter ();
244- }
245-
246- localTarget .Formatter = _root ._singletonPersonFormatter53 ;
247- return localTarget ;
248- };
249- }
226+ _root ._singletonFunc59 = source =>
227+ {
228+ if (_root ._singletonMapper56 is null )
229+ {
230+ EnsureLoggerFactoryExists ();
231+ LoggerFactory localLoggerFactory = _root ._singletonLoggerFactory54 ;
232+ // Create the mapping configuration
233+ var localConfiguration = new MapperConfiguration (cfg =>
234+ {
235+ cfg .CreateMap <Student , Person >();
236+ }, localLoggerFactory );
237+ localConfiguration .CompileMappings ();
238+ // Create the mapper
239+ _root ._singletonMapper56 = new Mapper (localConfiguration );
240+ }
241+
242+ AutoMapper .IMapper localMapper = _root ._singletonMapper56 ;
243+ // source -> target
244+ Person localTarget = localMapper .Map <Student , Person >(source );
245+ // Building-up a mapped value with dependencies
246+ if (_root ._singletonPersonFormatter53 is null )
247+ {
248+ _root ._singletonPersonFormatter53 = new PersonFormatter ();
249+ }
250250
251- if (_root ._singletonILogger55 is null )
252- lock (_lock )
253- if (_root ._singletonILogger55 is null )
254- {
255- EnsureLoggerFactoryExists ();
256- LoggerFactory localLoggerFactory1 = _root ._singletonLoggerFactory54 ;
257- _root ._singletonILogger55 = localLoggerFactory1 .CreateLogger (" info" );
251+ localTarget .Formatter = _root ._singletonPersonFormatter53 ;
252+ return localTarget ;
253+ };
254+ }
255+
256+ if (_root ._singletonILogger55 is null )
257+ {
258+ EnsureLoggerFactoryExists ();
259+ LoggerFactory localLoggerFactory1 = _root ._singletonLoggerFactory54 ;
260+ _root ._singletonILogger55 = localLoggerFactory1 .CreateLogger (" info" );
261+ }
262+
263+ _root ._singletonProgram58 = new Program (_root ._singletonILogger55 , new StudentService (_root ._singletonFunc59 ));
258264 }
259265
260- return new Program ( _root ._singletonILogger55 , new StudentService ( _root . _singletonFunc59 )) ;
266+ return _root ._singletonProgram58 ;
261267 [MethodImpl (MethodImplOptions .AggressiveInlining )]
262268 void EnsureLoggerFactoryExists ()
263269 {
@@ -282,6 +288,7 @@ partial class Composition: IDisposable
282288 _disposeIndex = 0 ;
283289 disposables = _disposables ;
284290 _disposables = new object [1 ];
291+ _singletonProgram58 = null ;
285292 _singletonILogger55 = null ;
286293 _singletonFunc59 = null ;
287294 _singletonMapper56 = null ;
0 commit comments