示例#1
0
        public async Task hard_delete_by_document_and_tenant_by_Guid()
        {
            var doc1 = new GuidDoc {
                Id = Guid.NewGuid()
            };


            theSession.ForTenant("red").Store(doc1);
            theSession.ForTenant("blue").Store(doc1);

            await theSession.SaveChangesAsync();

            theSession.ForTenant("red").HardDelete(doc1);

            using var query = theStore.QuerySession();

            var redCount = await query.Query <GuidDoc>().Where(x => x.TenantIsOneOf("red"))
                           .CountAsync();

            redCount.ShouldBe(0);

            var blueCount = await query.Query <GuidDoc>().Where(x => x.TenantIsOneOf("blue"))
                            .CountAsync();

            blueCount.ShouldBe(1);
        }
        public async Task stream_by_Guid_id_hit()
        {
            var doc = new GuidDoc {
            };

            theSession.Store(doc);
            await theSession.SaveChangesAsync();

            var stream = new MemoryStream();
            var found  = await theSession.Json.StreamById <GuidDoc>(doc.Id, stream);

            found.ShouldBeTrue();

            var target = deserialize <GuidDoc>(stream);

            target.Id.ShouldBe(doc.Id);
        }