Esempio n. 1
0
        public static CustomDbParameterList GetMemberParameters <T>(this T instance, params Expression <Func <T, object> >[] expressions)
        {
            string name = null;
            object value;
            CustomDbParameterList plist = new CustomDbParameterList();
            PropertyInfo          prop;

            foreach (var cExpression in expressions)
            {
                name = GetMemberName(cExpression.Body);
                if (cExpression.Body is MemberExpression)
                {
                    prop = (PropertyInfo)((MemberExpression)cExpression.Body).Member;
                }
                else
                {
                    var op = ((UnaryExpression)cExpression.Body).Operand;
                    prop = (PropertyInfo)((MemberExpression)op).Member;
                }
                // prop = (PropertyInfo)((MemberExpression)cExpression.Body).Member;
                value = prop.GetValue(instance);
                plist.Add(name, value);

                /*p = new SqlParameter(name, value);
                 * parameters.Add(p);*/
            }
            return(plist);
        }
 public static List <T> RetrieveEntityList <T>(string procedureName, CustomDbParameterList customParameters)
 {
     return(RetrieveEntityList <T>(procedureName, customParameters.Parameters));
 }
 public static T RetrieveEntitySingleOrDefault <T>(string procedureName, CustomDbParameterList customParameters)
 {
     return(RetrieveEntitySingleOrDefault <T>(procedureName, customParameters.Parameters));
 }
 public static Dictionary <string, object> RetrieveMultiRecordSet(string procedureName, CustomDbParameterList customParameters, params Type[] types)
 {
     return(RetrieveMultiRecordSet(procedureName, customParameters.Parameters, types));
 }
 public static object ExecuteScalarStoredProcedure(string procedureName, CustomDbParameterList customParameters)
 {
     return(ExecuteScalarStoredProcedure(procedureName, customParameters.Parameters));
 }