@@ -39,7 +39,7 @@ namespace ToSic.Sxc.Dnn.Search;
3939internal class SearchController (
4040 AppsCacheSwitch appsCache ,
4141 Generator < CodeCompiler > codeCompiler ,
42- Generator < IExecutionContextFactory > codeRootFactory ,
42+ Generator < IExecutionContextFactory > exCtxFactory ,
4343 Generator < ISite > siteGenerator ,
4444 LazySvc < IModuleAndBlockBuilder > moduleAndBlockBuilder ,
4545 LazySvc < ILookUpEngineResolver > dnnLookUpEngineResolver ,
@@ -49,7 +49,7 @@ internal class SearchController(
4949 : ServiceBase ( "DNN.Search" ,
5050 connect :
5151 [
52- appsCache , codeCompiler , codeRootFactory , siteGenerator , engineFactory , dnnLookUpEngineResolver ,
52+ appsCache , codeCompiler , exCtxFactory , siteGenerator , engineFactory , dnnLookUpEngineResolver ,
5353 moduleAndBlockBuilder , logStore , polymorphism
5454 ] )
5555{
@@ -311,15 +311,20 @@ private ICustomizeSearch CreateAndInitViewController(ISite site, IBlock block)
311311 l . A ( "got instance of compiled ViewController class" ) ;
312312
313313 // 2. Check if it implements ToSic.Sxc.Search.ICustomizeSearch - otherwise just return the empty search results as shown above
314- if ( ! ( instance is ICustomizeSearch customizeSearch ) )
314+ if ( instance is not ICustomizeSearch customizeSearch )
315315 return l . ReturnNull ( "exit, class do not implements ICustomizeSearch" ) ;
316316
317317 // 3. Make sure it has the full context if it's based on DynamicCode (like Code12)
318318 if ( instance is INeedsExecutionContext instanceWithContext )
319319 {
320320 l . A ( $ "attach DynamicCode context to class instance") ;
321- var parentDynamicCodeRoot = codeRootFactory . New ( )
322- . New ( null , block , Log , CompatibilityLevels . CompatibilityLevel10 ) ;
321+ var parentDynamicCodeRoot = exCtxFactory . New ( ) . New ( new ( )
322+ {
323+ OwnerOrNull = null ,
324+ BlockOrNull = block ,
325+ ParentLog = Log ,
326+ CompatibilityFallback = CompatibilityLevels . CompatibilityLevel10 ,
327+ } ) ;
323328 instanceWithContext . ConnectToRoot ( parentDynamicCodeRoot ) ;
324329 }
325330
0 commit comments