Example #1
0
        public void Where <T>(string transformName, Expression <Func <T, bool> > @where)
        {
            var transform = _tenant.TransformFor(transformName);
            var mapping   = _tenant.MappingFor(typeof(T));

            using var session = (DocumentSessionBase)_store.LightweightSession();
            var operation = new DocumentTransformOperationFragment(mapping, transform);
            var statement = new StatementOperation(session.StorageFor <T>(), operation);

            statement.ApplyFiltering(session, @where);
            session.UnitOfWork.Add(statement);
            session.SaveChanges();
        }
        public void All <T>(string transformName)
        {
            var transform = _tenant.TransformFor(transformName);
            var storage   = _tenant.StorageFor <T>();

            using var session = (DocumentSessionBase)_store.LightweightSession();
            var operation = new DocumentTransformOperationFragment(storage, transform);
            var statement = new StatementOperation(storage, operation);

            // To bake in the default document filtering here
            statement.CompileLocal(session);
            session.WorkTracker.Add(statement);
            session.SaveChanges();
        }
Example #3
0
        private void transformOne <T>(string transformName, ISqlFragment filter)
        {
            var transform = _tenant.TransformFor(transformName);
            var mapping   = _tenant.MappingFor(typeof(T));

            using var session = (DocumentSessionBase)_store.LightweightSession();
            var operation = new DocumentTransformOperationFragment(mapping, transform);
            var statement = new StatementOperation(session.StorageFor <T>(), operation);

            // To bake in the default document filtering here
            statement.Where = filter;
            statement.CompileLocal(session);
            session.UnitOfWork.Add(statement);
            session.SaveChanges();
        }