Пример #1
0
        public async Task <bool> InsertAsync <TEntity>(TEntity[] entities) where TEntity : Entity, new()
        {
            var properties = typeof(TEntity).GetReadWriteProperties();
            var query      = new QueryBuilder <TEntity>(connectorQuery, properties);
            var queries    = query.BuildBulkInsert(properties, entities);

            for (var i = 0; i < queries.Count; i++)
            {
                if (!await ExecuteAsync(queries[i]))
                {
                    return(false);
                }
            }

            return(true);
        }
Пример #2
0
        public async ValueTask <bool> InsertAsync <TEntity>(IReadOnlyList <TEntity> entities) where TEntity : Entity, new()
        {
            var properties = typeof(TEntity).GetReadWriteProperties();
            var builder    = new QueryBuilder <TEntity>(Connector.Query, properties);
            var queries    = builder.BuildBulkInsert(properties, entities);

            for (var i = 0; i < queries.Count; i++)
            {
                if (!await ExecuteAsync(builder))
                {
                    return(false);
                }
            }

            return(true);
        }