Esempio n. 1
0
        private static async Task StreamManyTransformed(this IMartenLinqQueryable martenQueryable, string transformName,
                                                        Stream destination, CancellationToken token)
        {
            var builder = martenQueryable.BuildLinqHandler();

            var session = martenQueryable.Session;

            await session.Database.EnsureStorageExistsAsync(typeof(TransformSchema), token).ConfigureAwait(false);

            var transform = session.Options.TransformFor(transformName);

            builder.CurrentStatement.SelectClause =
                new TransformSelectClause <string>(transform, builder.CurrentStatement.SelectClause);

            var statement = builder.TopStatement;
            var command   = statement.BuildCommand();

            await session.StreamMany(command, destination, token).ConfigureAwait(false);
        }
Esempio n. 2
0
        private static Task StreamManyTransformed(this IMartenLinqQueryable martenQueryable, string transformName,
                                                  Stream destination, CancellationToken token)
        {
            var builder = martenQueryable.BuildLinqHandler();

            var session = martenQueryable.Session;
            var tenant  = session.Tenant;

            // TODO -- use async version
            tenant.EnsureStorageExists(typeof(TransformSchema));

            var transform = tenant.TransformFor(transformName);

            builder.CurrentStatement.SelectClause =
                new TransformSelectClause <string>(transform, builder.CurrentStatement.SelectClause);

            var statement = builder.TopStatement;
            var command   = statement.BuildCommand();

            return(session.Database.StreamMany(command, destination, token));
        }
Esempio n. 3
0
        private static async Task StreamOneTransformed(this IMartenLinqQueryable martenQueryable, string transformName,
                                                       Stream destination, CancellationToken token)
        {
            var builder = martenQueryable.BuildLinqHandler();

            var session = martenQueryable.Session;
            var tenant  = session.Tenant;

            await tenant.EnsureStorageExistsAsync(typeof(TransformSchema), token);

            var transform = tenant.TransformFor(transformName);

            builder.CurrentStatement.SelectClause =
                new TransformSelectClause <string>(transform, builder.CurrentStatement.SelectClause);

            var statement = builder.TopStatement;

            statement.Current().Limit = 1;
            var command = statement.BuildCommand();

            await session.Database.StreamOne(command, destination, token);
        }