Пример #1
0
        /// <summary>
        /// Execute Insert query over db connection
        /// </summary>
        /// <param name="entity">model information</param>
        /// <returns></returns>
        public T Insert(T entity)
        {
            var    dynamicParameters = new DynamicParameters();
            string query             = _queryHelper.InsertQuery(entity, ref dynamicParameters);

            var aux = _connection.ExecuteScalarAsync(
                query,
                dynamicParameters,
                commandType: CommandType.Text,
                transaction: _unitOfWork.Transaction
                ).GetAwaiter().GetResult();

            T result = _queryHelper.AddEntityId(entity, aux);

            return(result);
        }