我将LDAP作为在工作中管理访问服务器和源代码的可能工具,虽然我已经能够掌握基本概念,例如将用户和机器表示为实体,创建属性,以及定义哪些属性应该应用于基于应用于它们的objectClasses的实体,有一些错误对我来说仍然没有意义,我希望有人可以帮助解释它们是如何工作的.
我可以理解ou(组织单位)是什么,我可以理解将人们置于其中,并使用groupOfNames类作为成员的容器,例如来自zytrax的 LDIF片段:
# create FIRST Level groups branch
dn: ou=groups,dc=example,dc=com
objectclass:organizationalunit
ou: groups
description: generic groups branch
# create the itpeople entry under groups
dn: cn=itpeople,ou=groups,dc=example,dc=com
objectclass: groupofnames
cn: itpeople
description: IT security group
member: cn=William Smith,ou=people,dc=example,dc=com
# create the hrpeople entry under groups
dn: cn=hrpeople,ou=groups,dc=example,dc=com
objectclass: groupofnames
cn: hrpeople
description: Human Resources group
member: cn=Robert Smith,ou=people,dc=example,dc=com
Run Code Online (Sandbox Code Playgroud)
我所追求的是这里的伪代码:
ou='Projects' /
description: This top level group has a few people in it that can create …Run Code Online (Sandbox Code Playgroud) 我正在尝试获得4个List深度列表集合List<List<List<List<int>>>>.从我的Xml看起来像
<root>
<Claim key="1" carrier="carA" zip="34343" pages="1"/>
<Claim key="2" carrier="carA" zip="34343" pages="2"/>
<Claim key="3" carrier="carB" zip="10505" pages="2"/>
<Claim key="4" carrier="carB" zip="10505" pages="4"/>
<Claim key="5" carrier="carB" zip="10505" pages="4"/>
</root>
Run Code Online (Sandbox Code Playgroud)
输出的结构应该是这样的
-all
-1
-34343
-carA
-1
-2
-34343
-carA
-2
-10505
-carB
-3
-4
-10505
-carB
-4
-5
Run Code Online (Sandbox Code Playgroud)
目标是首先根据节点属性按页数,然后按zip,然后按运营商对XML进行排序.然后,我需要遍历结果列表并按特定顺序处理每个声明.我无法获得3个嵌套组的语法.我已经完成了获得2个嵌套组,任何人都可以帮助我获得第三个.
到目前为止,这是我的代码.
var query = from claim in root.Elements("Claim")
group claim by claim.Attributes("Pages").First().Value into pageGroups
from zipGroups in
(from claim in pageGroups
group claim by int.Parse(claim.Attributes("CarrierZip").First().Value))
group zipGroups by pageGroups.Key;
Run Code Online (Sandbox Code Playgroud) 如何将SubGroup分组以创建大陆列表,其中每个大陆都有自己的县,每个国家/地区都有自己的城市,如此表
这是t-sql:
select Continent.ContinentName, Country.CountryName, City.CityName
from Continent
left join Country
on Continent.ContinentId = Country.ContinentId
left join City
on Country.CountryId = City.CountryId
Run Code Online (Sandbox Code Playgroud)
和t-sql的结果:
我尝试了这个,但它以错误的方式对数据进行分组,我需要像上表一样进行分组
var Result = MyRepository.GetList<GetAllCountriesAndCities>("EXEC sp_GetAllCountriesAndCities");
List<Continent> List = new List<Continent>();
var GroupedCountries = (from con in Result
group new
{
con.CityName,
}
by new
{
con.ContinentName,
con.CountryName
}
).ToList();
List<Continent> List = GroupedCountries.Select(c => new Continent()
{
ContinentName = c.Key.ContinentName,
Countries = c.Select(w => new Country()
{
CountryName = c.Key.CountryName,
Cities = c.Select(ww => new City() …Run Code Online (Sandbox Code Playgroud)