Пример #1
0
        public void CanPersistTenant()
        {
            var t = new Tenant(123, "t1");
            Session.Save(t);

            Session.Flush();
            Session.Clear();

            var t1 = Session.Load<Tenant>(123L);

            Assert.Equal("t1", t1.Name);
        }
        public void CanPersistWithOtherTenantId()
        {
            SaveInterceptorTenantId = 666;
            var t666 = new Tenant(666, "t666");
            Session.Save(t666);
            var c = new Contact("c");
            Session.Save(c);

            Session.Flush();
            Session.Clear();

            using(var cmd = Session.Connection.CreateCommand())
            {
                cmd.CommandText = "select tenantid from Contact where name = 'c'";
                Assert.Equal(666L, Convert.ToInt64(cmd.ExecuteScalar()));
            }
        }