コード例 #1
0
 public static Task <TEntity> InsertAsync <TKey, TEntity>(this INewEntityStore <TKey, TEntity> newStore, IStorageDbConnection conn, TEntity entityToInsert, IEnumerable <Expression <Func <TEntity, object> > > ignoredFields, IDbTransaction tr, CancellationToken cancellationToken)
     where TKey : IEquatable <TKey>
     where TEntity : class, IEntity <TKey>
 {
     if (newStore == null)
     {
         throw new ArgumentNullException(nameof(newStore));
     }
     return(newStore.InsertAsync(conn, entityToInsert, ignoredFields, null, tr, cancellationToken));
 }
コード例 #2
0
 public static Task <TEntity> InsertAsync <TKey, TEntity>(this INewEntityStore <TKey, TEntity> newStore, IStorageDbConnection conn, TEntity entityToInsert, AutoIncrementTransformer <TKey, TEntity> atf, CancellationToken cancellationToken)
     where TKey : IEquatable <TKey>
     where TEntity : class, IEntity <TKey>
 {
     if (newStore == null)
     {
         throw new ArgumentNullException(nameof(newStore));
     }
     return(newStore.InsertAsync(conn, entityToInsert, null, atf, null, cancellationToken));
 }
コード例 #3
0
 public static Task <TEntity> InsertAsync <TKey, TEntity>(this INewEntityStore <TKey, TEntity> newStore, IStorageDbConnection conn, TEntity entityToInsert, IDbTransaction tr)
     where TKey : IEquatable <TKey>
     where TEntity : class, IEntity <TKey>
 {
     if (newStore == null)
     {
         throw new ArgumentNullException(nameof(newStore));
     }
     return(newStore.InsertAsync(conn, entityToInsert, null, null, tr, default(CancellationToken)));
 }
コード例 #4
0
 public static Task <TEntity> InsertAutoIncrementAsync <TKey, TEntity>(this INewEntityStore <TKey, TEntity> newStore, IStorageDbConnection conn, TEntity entityToInsert, IDbTransaction tr, CancellationToken cancellationToken)
     where TKey : IEquatable <TKey>
     where TEntity : class, IEntity <TKey>
 {
     if (newStore == null)
     {
         throw new ArgumentNullException(nameof(newStore));
     }
     return(newStore.InsertAsync(conn, entityToInsert, new Expression <Func <TEntity, object> >[] { _ => _.Id, }, (a, b) => b.Id = a, tr, cancellationToken));
 }
コード例 #5
0
 public static TEntity Insert <TKey, TEntity>(this INewEntityStore <TKey, TEntity> newStore, IStorageDbConnection conn, TEntity entityToInsert, IEnumerable <Expression <Func <TEntity, object> > > ignoredFields, AutoIncrementTransformer <TKey, TEntity> atf)
     where TKey : IEquatable <TKey>
     where TEntity : class, IEntity <TKey>
 {
     if (newStore == null)
     {
         throw new ArgumentNullException(nameof(newStore));
     }
     return(newStore.Insert(conn, entityToInsert, ignoredFields, atf, null));
 }
コード例 #6
0
 public static TEntity Insert <TKey, TEntity>(this INewEntityStore <TKey, TEntity> newStore, IStorageDbConnection conn, TEntity entityToInsert, AutoIncrementTransformer <TKey, TEntity> atf, IDbTransaction tr)
     where TKey : IEquatable <TKey>
     where TEntity : class, IEntity <TKey>
 {
     if (newStore == null)
     {
         throw new ArgumentNullException(nameof(newStore));
     }
     return(newStore.Insert(conn, entityToInsert, null, atf, tr));
 }
コード例 #7
0
        // auto_increment = true

        public static TEntity Insert <TKey, TEntity>(this INewEntityStore <TKey, TEntity> newStore, IStorageDbConnection conn, TEntity entityToInsert)
            where TKey : IEquatable <TKey>
            where TEntity : class, IEntity <TKey>
        {
            if (newStore == null)
            {
                throw new ArgumentNullException(nameof(newStore));
            }
            return(newStore.Insert(conn, entityToInsert, null, null, null));
        }
コード例 #8
0
 // auto_increment
 public static TEntity InsertAutoIncrement <TKey, TEntity>(this INewEntityStore <TKey, TEntity> newStore, IStorageDbConnection conn, TEntity entityToInsert)
     where TKey : IEquatable <TKey>
     where TEntity : class, IEntity <TKey>
 {
     if (newStore == null)
     {
         throw new ArgumentNullException(nameof(newStore));
     }
     return(newStore.Insert(conn, entityToInsert, new Expression <Func <TEntity, object> >[] { _ => _.Id, }, (a, b) => b.Id = a, null));
 }