IAzManStoreGroupMember (TryGetValue) ? (By StoreGroupMemberName)

Topics: NetSqlAzMan Core
Mar 21, 2012 at 6:40 PM

 

string storeName = "MyStoreName";

string storeGroupName = "MyStoreGroupName";

string storeGroupMemberName = "What_I_Am_Looking_For";

 

                IAzManStore foundStore = null;
                storage.Stores.TryGetValue(storeName, out foundStore);

                if (foundStore == null)
                {
                    throw new ArgumentNullException(string.Format(CONSTANTS_ERROR_MESSAGES.STORE_MESSAGE_STORE_DOES_NOT_EXIST, storeName));
                }


                IAzManStoreGroup foundStoreGroup = null;
                foundStore.StoreGroups.TryGetValue(storeGroupName, out foundStoreGroup);

                if (foundStoreGroup == null)
                {
                    throw new ArgumentNullException(string.Format(CONSTANTS_ERROR_MESSAGES.STORE_GROUP_MESSAGE_STORE_DOES_NOT_EXIST, storeGroupName));
                }


                SIDHelper sidhelp = new SIDHelper();/* not seen, a custom factory object */
                IAzManSid sid = sidhelp.CreateSIDFromWindowsIdentity(null);  /* not seen */


                IAzManStoreGroupMember returnObject = null;
                returnObject = foundStoreGroup.GetStoreGroupMember(sid);

 

 

The last line blows up....and I cannot find the TryGetValue for this one.

And I'm trying to find by "storeGroupMemberName", not SID.

Thanks for any advice!

 

 

Mar 21, 2012 at 7:45 PM

Depending what you have and what you want to accomplish, you may try:

if(foundStoreGroup.IsInGroup(windowsIdentity)

{

SqlAzManSid  sid = windowsIndentity;

returnObject = foundStoreGroup.GetStoreGroupMember(sid);

}