コード例 #1
0
        public async Task <int> EasyInsertAsync <T>(T data) where T : class
        {
            await EnsureOpenAsync();

            EnsureDapperTypeMapping(typeof(T));

            return(await SqlMapperExtensions.InsertAsync <T>(Connection, data, Transaction));
        }
コード例 #2
0
 public async Task Create(T entity)
 {
     await SqlMapperExtensions.InsertAsync(_connection, entity);
 }
コード例 #3
0
 public async Task <long> SaveAsync(TEntity entity)
 {
     using (var sqlConnection = new SqlConnection(DbConstant.DatabaseConnection))
         return(await SqlMapperExtensions.InsertAsync(sqlConnection, entity));
 }
コード例 #4
0
ファイル: DapperRepository.cs プロジェクト: lulzzz/Virgo
 public async Task <int> InsertAsync(IEnumerable <TEntity> entities, ISqlAdapter sqlAdapter = null)
 {
     return(await SqlMapperExtensions.InsertAsync(_connection, entities, _transaction, _commandTimeout, sqlAdapter));
 }
コード例 #5
0
ファイル: DapperRepository.cs プロジェクト: lulzzz/Virgo
 public async Task <int> InsertAsync(TEntity entityToInsert, ISqlAdapter sqlAdapter = null)
 {
     return(await SqlMapperExtensions.InsertAsync(_connection, entityToInsert, _transaction, _commandTimeout, sqlAdapter));
 }
 public static Task <int> InsertAsync <T>(this IDbConnection connection, T entityToInsert, bool enumAsString = false, IDbTransaction transaction = null, int?commandTimeout = null, ISqlAdapter sqlAdapter = null) where T : class
 {
     return(enumAsString ? InsertWithEnumAsStringAsync(connection, entityToInsert) : SqlMapperExtensions.InsertAsync(connection, entityToInsert, transaction, commandTimeout, sqlAdapter));
 }