public IEnumerable <CommandResult> GetData(string query, CommandType type, params CommandParameter[] parameters) { using (var internalCmd = new InternalCommand(_unitofWork, _conFactory)) { foreach (var result in internalCmd.ExecMapperCommand(query, type, parameters)) { yield return(result); } } }
public IList <T> Search(string query, CommandType type, params CommandParameter[] parameters) { var mapperMain = new MapperMain <T>(); var modelProperties = typeof(T).GetTypeProperties(ExcludeTypes.Select); using (var internalCmd = new InternalCommand(_conFactory)) { foreach (var result in internalCmd.ExecMapperCommand(query, type, parameters)) { var instance = Activator.CreateInstance <T>(); mapperMain.Map(result, instance, modelProperties); } } return(mapperMain.ItemsList); }