Created
April 13, 2023 08:43
-
-
Save ArtemyB/07013dfb7bf4b526c1b8dd167b869921 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Claim = { Name: string; Value: string } | |
type Mapping = { Group: string; Roles: string list } | |
let mapping = [ | |
{ Group = "aaa"; Roles = [ "Admin" ] } | |
{ Group = "ccc"; Roles = [ "King" ] } | |
{ Group = "uuu"; Roles = [ "User" ] } | |
] | |
let groups = [ "aaa"; "bbb"; "ccc" ] | |
let joinedList = | |
query { | |
for group in groups do | |
join mapping in mapping on (group.ToUpperInvariant() = mapping.Group.ToUpperInvariant()) | |
select mapping | |
} |> Seq.toList | |
// The same query in C# LINQ: | |
// var joined = | |
// ( | |
// from adGroup in groups | |
// join mappingRecord in mapping | |
// on adGroup.ToUpperInvariant() equals mappingRecord.Group.ToUpperInvariant() | |
// select mappingRecord | |
// ).ToList(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment