private ComposeEntity FindComposity(AppConfig appconfig, string allname) { lock (lockobj) { ComposeEntity cons = null; if (APPCommon.AppConfig.IsUseGloableCahe) { cons = APP.Composeentitys.FirstOrDefault(p => p.Guid == appconfig.StartUpCompoistyID); if (cons == null) { cons = CodeService.GetConposity(appconfig.StartUpCompoistyID, allname).FirstOrDefault(); if (cons != null) { APP.Composeentitys.Add(cons); } } } else { cons = CodeService.GetConposity(appconfig.StartUpCompoistyID, allname).FirstOrDefault(); } if (cons == null) { cons = new ComposeEntity() { Name = allname, RunMode = RunMode.Coding, Guid = appconfig.StartUpCompoistyID }; var reint = CodeService.InsertCode(cons); APP.Composeentitys.Add(cons); } return(cons); } }
private static async Task CheckAndRunNextRuntimeComposity(int requsetHash, HttpContext httpContext, RuntimeStepModel newrunmodel, ISqlSugarClient dbFactory, ISysDatabaseService codeService, IConfiguration config) { var resouce = newrunmodel.Resuce(newrunmodel.NextRunTimeKey); if (resouce != null) { var guid = (string)resouce; if (string.IsNullOrEmpty(guid)) { //newrunmodel.ResouceInfos.Remove(newrunmodel.NextRunTimeKey); return; } var nextcon = codeService.GetConposity(guid).FirstOrDefault(); if (nextcon == null) { nextcon = new ComposeEntity() { Guid = guid, RunMode = RunMode.Coding }; var reint = codeService.InsertCode(nextcon); } else { var nextRnmodel = new RuntimeStepModel(config) { ParentRuntimeModel = newrunmodel, Res = newrunmodel.Res, ComposeEntity = nextcon, HashCode = nextcon.GetHash() }; nextRnmodel.Res.Remove(newrunmodel.NextRunTimeKey); await RunComposity(requsetHash, httpContext, nextRnmodel, dbFactory, codeService, config); } } }