public T GetById(T entity)
        {
            var parms             = ParametersMapper.RetornaParametros(entity, _entityMap, QueryType.SelectById);
            var selectByIdCommand = QueryMapper.ReturnSqlQuery(_entityMap, QueryType.SelectById);

            using IDbConnection db = new SqlConnection(_connectionString);
            return(db.Query <T>(selectByIdCommand, parms, commandType: CommandType.Text).FirstOrDefault());
        }
        public bool Insert(T entity)
        {
            var parms         = ParametersMapper.RetornaParametros(entity, _entityMap, QueryType.Insert);
            var insertCommand = QueryMapper.ReturnSqlQuery(_entityMap, QueryType.InsertWithCount);

            using IDbConnection db = new SqlConnection(_connectionString);
            return(db.ExecuteScalar <int>(insertCommand, parms, commandType: CommandType.Text) > 0);
        }
        public QueryResult Insert(List <T> entityList)
        {
            var parms         = ParametersMapper.RetornaParametros(entityList, _entityMap, QueryType.InsertMultiple);
            var insertCommand = QueryMapper.ReturnSqlQuery(entityList.Count, _entityMap, QueryType.InsertMultiple);

            using IDbConnection db = new SqlConnection(_connectionString);
            var queryReturn = db.Query(insertCommand, parms, commandType: CommandType.Text).FirstOrDefault();

            return(GetSqlTransactionReturn(queryReturn));
        }
        public void Insert(T entity, IDbConnection cnn, IDbTransaction trans)
        {
            if (cnn == null)
            {
                throw new ArgumentNullException(nameof(cnn), "Conexão não pode ser nula");
            }

            if (trans == null)
            {
                throw new ArgumentNullException(nameof(trans), "Transação não pode ser nula");
            }

            var parms         = ParametersMapper.RetornaParametros <T>(entity, _entityMap, QueryType.Insert);
            var insertCommand = QueryMapper.ReturnSqlQuery <T>(_entityMap, QueryType.Insert);

            cnn.Query(insertCommand, parms, trans, commandType: CommandType.Text);
        }
        public void Delete(T entity, IDbConnection cnn, IDbTransaction trans)
        {
            if (cnn == null)
            {
                throw new ArgumentNullException("cnn", "Conexão não pode ser nula");
            }

            if (trans == null)
            {
                throw new ArgumentNullException("trans", "Transação não pode ser nula");
            }

            var parms     = ParametersMapper.RetornaParametros(entity, _entityMap, QueryType.Delete);
            var deleteSql = QueryMapper.ReturnSqlQuery(_entityMap, QueryType.Delete);

            using IDbConnection db = new SqlConnection(_connectionString);
            cnn.Execute(deleteSql, parms, trans, commandType: CommandType.Text);
        }