public InternalProcedureParameterInfo GetProcedureParameter(Type pmbType, PropertyInfo property) { String propertyName = property.Name; String annotationName = InitUncap(propertyName) + PROCEDURE_PARAMETER_SUFFIX; FieldInfo field = pmbType.GetField(annotationName, BindingFlags.Public | BindingFlags.Static); if (field != null) { String annotationValue = (String)field.GetValue(null); InternalProcedureParameterInfo info = new InternalProcedureParameterInfo(); String[] values = annotationValue.Split(','); if (values.Length != 2) { String msg = "The value of annotation is wrong."; msg = msg + " You should set '[parameterName], [parameterType]'."; msg = msg + " But: annotation=" + annotationName + " value=" + annotationValue; throw new IllegalStateException(msg); } info.ParameterName = values[0].Trim(); info.ParameterType = values[1].Trim(); return(info); } else { return(null); } }
protected InternalProcedureParameterType GetProcedureParameterType(Type pmbType, PropertyInfo property) { InternalProcedureParameterInfo info = _annotationReader.GetProcedureParameter(pmbType, property); if (info == null) { return(null); } String name = info.ParameterName; String type = info.ParameterType; type = type.ToLower(); InternalProcedureParameterType ppt = new InternalProcedureParameterType(name, property); if (type.Equals("in")) { ppt.IsInType = true; ppt.ParameterDirectionType = ParameterDirection.Input; } else if (type.Equals("out")) { ppt.IsOutType = true; ppt.ParameterDirectionType = ParameterDirection.Output; } else if (type.Equals("inout")) { ppt.IsInType = true; ppt.IsOutType = true; ppt.ParameterDirectionType = ParameterDirection.InputOutput; } else if (type.Equals("return")) { // *Set false to IsOutType // The return is not out-parameter at ADO.NET! // though JDBC treats it as out-parameter. // ppt.IsOutType = true; ppt.IsReturnType = true; ppt.ParameterDirectionType = ParameterDirection.ReturnValue; } else { throw new IllegalStateException("The parameter type is wrong: type=" + type); } return(ppt); }