private void OnExecute(IConsole console) { var destPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "b2c.json"); var sb = new StringBuilder(); var tn = Tenant.Contains("onmicrosoft.com") ? Tenant : Tenant + ".onmicrosoft.com"; sb.AppendLine("{"); sb.AppendLine($"\"AppId\": \"{AppId}\","); sb.AppendLine($"\"Tenant\": \"{Tenant}\","); sb.AppendLine($"\"Secret\": \"{Secret}\""); sb.AppendLine("}"); File.WriteAllText(destPath, sb.ToString()); console.WriteLine($"Graph configuration successfully written to {destPath}"); }
private IReadOnlyDictionary <Reference, string> Resolve(IEnumerable <Reference> references) { var searchKeys = references.Select(x => new { x.Id, x.EntityType }); // Есть сущности, общие для всех инсталляций - их имена имеют TenantId = 0; var tenants = new Tenant[] { 0, _tenantProvider.Current }; using (var connection = _connectionProvider.CreateVrConnection()) { return(connection .GetTable <EntityName>() .Where(x => tenants.Contains(x.TenantId)) .Where(x => searchKeys.Contains(new { x.Id, x.EntityType })) .ToDictionary(x => new Reference(x.EntityType, x.Id), x => x.Name)); } }