public void ExtendAsync(ExecutionContext context) { if (!context.TryGetValue <DomainId>(nameof(ScriptVars.AppId), out var appId)) { return; } if (!context.TryGetValue <ClaimsPrincipal>(nameof(ScriptVars.User), out var user)) { return; } var action = new GetAssetsDelegate((references, callback) => GetAssets(context, appId, user, references, callback)); context.Engine.SetValue("getAsset", action); context.Engine.SetValue("getAssets", action); }
private void AddAsset(ScriptExecutionContext context) { if (!context.TryGetValue <DomainId>("appId", out var appId)) { return; } if (!context.TryGetValue <ClaimsPrincipal>("user", out var user)) { return; } var action = new GetAssetsDelegate((references, callback) => GetAssets(context, appId, user, references, callback)); context.Engine.SetValue("getAsset", action); context.Engine.SetValue("getAssets", action); }