public IContextOfApp AppOrNull(string nameOrPath) { if (string.IsNullOrWhiteSpace(nameOrPath)) { return(null); } var id = AppIdResolver.GetAppIdFromPath(Site().Site.ZoneId, nameOrPath, false); return(id <= Eav.Constants.AppIdEmpty ? null : App(id)); }
public IContextOfApp AppNameRouteBlock(string nameOrPath) { var ctx = AppOrNull(nameOrPath); if (ctx != null) { return(ctx); } var identity = AppIdResolver.GetAppIdFromRoute(); if (identity != null) { ctx = ServiceProvider.Build <IContextOfApp>(); ctx.Init(Log); ctx.ResetApp(identity); return(ctx); } ctx = BlockOrNull(); return(ctx ?? throw new Exception($"Tried to auto detect app by name '{nameOrPath}', url params or block context, all failed.")); }
public IContextOfApp App(string nameOrPath) => App(AppIdResolver.GetAppIdFromPath(Site().Site.ZoneId, nameOrPath, true));