private IEnumerable <DbParameter> GetInputParams(object input) { if (input != null) { // result of the properties InputParams result = new InputParams(); Type objectType = input.GetType(); if (objectType.IsDefined(typeof(DataContractAttribute), false)) { result.Set(GetInputParams(input, objectType)); return(result); } foreach (var property in objectType.GetProperties()) { var propertyType = property.PropertyType; var value = property.GetValue(input); if (propertyType.IsValueType) { if (propertyType.IsPrimitive || propertyType.IsEnum == false) { result[property.Name] = impl.GetInputParameter(value, property.Name, propertyType.FullName); } else { System.Reflection.FieldInfo field = propertyType.GetField(EnumValue, InstantPublic); result[property.Name] = impl.GetInputParameter(field.GetValue(value), property.Name, field.FieldType.FullName); } } else if (propertyType.IsSerializable) { //if generic type for dictionary if (propertyType.IsGenericType) { //Check whether Dictionary Value if (typeof(IDictionary).IsAssignableFrom(propertyType)) { result.Set(GetDictionaryParameter(value)); continue; } } result[property.Name] = GetSerializableParameter(value, property.Name, propertyType.FullName); } else if (propertyType.IsClass && value != null) { result.Set(GetInputParams(value, propertyType)); } } return(result); } return(new DbParameter[0]); }