private static Principal FindByIdentityWithTypeHelper(PrincipalContext context, Type principalType, IdentityType?identityType, string identityValue, DateTime refDate) { string stringMap; StoreCtx queryCtx = context.QueryCtx; Type type = principalType; if (!identityType.HasValue) { stringMap = null; } else { stringMap = (string)IdentMap.StringMap[identityType.Value, 1]; } Principal principal = queryCtx.FindPrincipalByIdentRef(type, stringMap, identityValue, refDate); if (principal == null) { return(null); } else { return(principal); } }