OK, I'll admit. My mind is fried, lol. Trying to find the best way to store some data. They are structured as follows:
Agency [DPW - West Broadway Facility]:
OU: OU=DPW,DC=server,DC=com
Security: CN=DPW Users,OU=DPW,DC=server,DC=com
CN=Water Facility,OU=DPW,DC=server,DC=com
CN=West Side,OU=Regions,DC=server,DC=com
So far the best I can think of is doing string[,] agencies = new string[40,3]. Then I could do it like:
agencies[1,0] = "DPW - West Broadway Facility";
agencies[1,1] = "OU=DPW,DC=server,DC=com";
agencies[1,2] = "CN=DPW Users,OU=DPW,DC=server,DC=com;CN=Water Facility,OU=DPW,DC=server,DC=com;CN=West Side,OU=Regions,DC=server,DC=com";
I can then just split on ; for facet 2. While this will work, it doesn't strike me as very elegant. However, the dictionary/arraylist/etc all seem to just be 1 key correlated to 1 value. Unless I'm just missing something, which is entirely possible lol.
Loading
Javeed M ShaikhPosted Oct 16, 2011, 9:27 PM
In dictionary you can contain multiple value for a key like this
Dictionary
ex: Dictionary
Please do not forget to mark "Accepted Answer".
KenPosted Oct 17, 2011, 8:43 AM
public Dictionary
(query crap)
at this point i have agency = the agency info,
ou = the ou ldap DN
a string[] groups which has all the groups for that ou
So now I can have one dictionary entry for the agency then the children will be ou/security:
List
tmpvar.Add(RS["ou"].ToString());
tmpvar.Add(String.Join(";", RS["groups"].ToString());
I see now what you meant by having to still split; I thought you meant to obtain my data originally, I see now that I'll still have to split it using the dict. It's not the end of the world but I.. ahhh wait, I can just change that List datatype to any datatype right? I can just change ti another dictionary :) Cool, tested OK. Nevermind. Now I have in my query loop:
Dictionary
tmpvar.Add("OU", RS["ou"].ToString());
for (x=0 to groupcoll.length) {
tmpvar.Add("Group" + x.ToString(), groupcoll[x]);
}
So I can end up just doing MessageBox.Show(Agencies["DPW"]["OU"]); Sweet. Of course, this probably ends up being slightly more code than I originally had just doing the string array, but it's nicer as I can use a string index rather than remembering numeric facet positions. Thanks again!
KenPosted Oct 17, 2011, 8:22 AM
Thanks!
VulpesPosted Oct 17, 2011, 5:08 AM