/// <summary> /// Returns the properties of a query object based on parameters defined in a /// SQL statement as well as properties with Where and Case attributes /// </summary> private static IEnumerable <PropertyInfo> GetParamProperties(object parameters, string sql, out QueryParameters paramInfo) { // this gets the param names within the query based on words with leading '@' paramInfo = RegexHelper.ParseParameters(sql, cleaned: true); var allParams = paramInfo.AllParamNames().Select(p => p.ToLower()).ToArray(); // these are the properties of the Query that are explicitly defined and may impact the WHERE clause var queryProps = parameters.GetType().GetProperties().Where(pi => pi.HasAttribute <WhereAttribute>() || pi.HasAttribute <CaseAttribute>() || pi.HasAttribute <PhraseAttribute>() || pi.HasAttribute <ParameterAttribute>() || allParams.Contains(pi.Name.ToLower())); return(queryProps); }