private PropertyInfo LoadAndValidateProperty(Type type, string propertyName) { PropertyInfo property = type.GetProperty(propertyName); if (property == null) { throw new AdomdConnectionException(XmlaSR.Authentication_ClaimsToken_AdalLoadingError(string.Format("{0}.{1} property", type.Name, propertyName))); } return(property); }
private object LoadAndValidateEnumValue(Type enumType, string enumValueName) { object obj = Enum.GetValues(enumType).Cast <object>().FirstOrDefault((object val) => val.ToString() == enumValueName); if (obj == null) { throw new AdomdConnectionException(XmlaSR.Authentication_ClaimsToken_AdalLoadingError(string.Format("{0}.{1} enum value", enumType.Name, enumValueName))); } return(obj); }
private Type LoadAndValidateType(Assembly assembly, string typeName) { Type type = assembly.GetType(typeName); if (type == null) { throw new AdomdConnectionException(XmlaSR.Authentication_ClaimsToken_AdalLoadingError(string.Format("{0} type", typeName))); } return(type); }
private MethodInfo LoadAndValidateMethod(Type type, string methodName, params Type[] argTypes) { MethodInfo methodInfo = (argTypes.Length == 0) ? type.GetMethod(methodName) : type.GetMethod(methodName, argTypes); if (methodInfo == null) { throw new AdomdConnectionException(XmlaSR.Authentication_ClaimsToken_AdalLoadingError(string.Format("{0}.{1}({2}) method", type.Name, methodName, string.Join(", ", (from t in argTypes select t.Name).ToArray <string>())))); } return(methodInfo); }
private static Stream GetResourceAsStream(string resourceName) { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string[] manifestResourceNames = executingAssembly.GetManifestResourceNames(); string text = manifestResourceNames.FirstOrDefault((string rn) => rn.EndsWith(resourceName)); if (text == null) { throw new AdomdConnectionException(XmlaSR.Authentication_ClaimsToken_AdalLoadingError(string.Format("{0} from embedded resource", resourceName))); } return(executingAssembly.GetManifestResourceStream(text)); }