示例#1
0
        public void 中文表_字段()
        {
            var item = new 测试中文表
            {
                标题   = "测试标题",
                创建时间 = DateTime.Now
            };

            Assert.Equal(1, g.odbc.Insert <测试中文表>().AppendData(item).ExecuteAffrows());
            Assert.NotEqual(Guid.Empty, item.编号);
            var item2 = g.odbc.Select <测试中文表>().Where(a => a.编号 == item.编号).First();

            Assert.NotNull(item2);
            Assert.Equal(item.编号, item2.编号);
            Assert.Equal(item.标题, item2.标题);
        }
示例#2
0
        public void 中文表_字段()
        {
            var sql = g.shentong.CodeFirst.GetComparisonDDLStatements <测试中文表>();

            g.shentong.CodeFirst.SyncStructure <测试中文表>();

            var item = new 测试中文表
            {
                标题   = "测试标题",
                创建时间 = DateTime.Now
            };

            Assert.Equal(1, g.shentong.Insert <测试中文表>().NoneParameter().AppendData(item).ExecuteAffrows());
            Assert.NotEqual(Guid.Empty, item.编号);
            var item2 = g.shentong.Select <测试中文表>().Where(a => a.编号 == item.编号).First();

            Assert.NotNull(item2);
            Assert.Equal(item.编号, item2.编号);
            Assert.Equal(item.标题, item2.标题);

            item.标题 = "测试标题更新";
            Assert.Equal(1, g.shentong.Update <测试中文表>().NoneParameter().SetSource(item).ExecuteAffrows());
            item2 = g.shentong.Select <测试中文表>().Where(a => a.编号 == item.编号).First();
            Assert.NotNull(item2);
            Assert.Equal(item.编号, item2.编号);
            Assert.Equal(item.标题, item2.标题);

            item.标题 = "测试标题更新_repo";
            var repo = g.shentong.GetRepository <测试中文表>();

            repo.DbContextOptions.NoneParameter = true;
            Assert.Equal(1, repo.Update(item));
            item2 = g.shentong.Select <测试中文表>().Where(a => a.编号 == item.编号).First();
            Assert.NotNull(item2);
            Assert.Equal(item.编号, item2.编号);
            Assert.Equal(item.标题, item2.标题);

            item.标题 = "测试标题更新_repo22";
            Assert.Equal(1, repo.Update(item));
            item2 = g.shentong.Select <测试中文表>().Where(a => a.编号 == item.编号).First();
            Assert.NotNull(item2);
            Assert.Equal(item.编号, item2.编号);
            Assert.Equal(item.标题, item2.标题);
        }
示例#3
0
        public void 中文表_字段()
        {
            var sql = g.oracle.CodeFirst.GetComparisonDDLStatements <测试中文表>();

            g.oracle.CodeFirst.SyncStructure <测试中文表>();

            var item = new 测试中文表 {
                标题   = "测试标题",
                创建时间 = DateTime.Now
            };

            Assert.Equal(1, g.oracle.Insert <测试中文表>().AppendData(item).ExecuteAffrows());
            Assert.NotEqual(Guid.Empty, item.编号);
            var item2 = g.oracle.Select <测试中文表>().Where(a => a.编号 == item.编号).First();

            Assert.NotNull(item2);
            Assert.Equal(item.编号, item2.编号);
            Assert.Equal(item.标题, item2.标题);
        }
示例#4
0
        public void 中文表_字段()
        {
            var item = new 测试中文表
            {
                标题   = "测试标题",
                创建时间 = DateTime.Now
            };

            Assert.Equal(1, g.odbc.Insert <测试中文表>().AppendData(item).ExecuteAffrows());
            Assert.NotEqual(Guid.Empty, item.编号);
            var item2 = g.odbc.Select <测试中文表>().Where(a => a.编号 == item.编号).First();

            Assert.NotNull(item2);
            Assert.Equal(item.编号, item2.编号);
            Assert.Equal(item.标题, item2.标题);

            item.标题 = "测试标题更新";
            Assert.Equal(1, g.odbc.Update <测试中文表>().SetSource(item).ExecuteAffrows());
            item2 = g.odbc.Select <测试中文表>().Where(a => a.编号 == item.编号).First();
            Assert.NotNull(item2);
            Assert.Equal(item.编号, item2.编号);
            Assert.Equal(item.标题, item2.标题);

            item.标题 = "测试标题更新_repo";
            var repo = g.odbc.GetRepository <测试中文表>();

            Assert.Equal(1, repo.Update(item));
            item2 = g.odbc.Select <测试中文表>().Where(a => a.编号 == item.编号).First();
            Assert.NotNull(item2);
            Assert.Equal(item.编号, item2.编号);
            Assert.Equal(item.标题, item2.标题);

            item.标题 = "测试标题更新_repo22";
            Assert.Equal(1, repo.Update(item));
            item2 = g.odbc.Select <测试中文表>().Where(a => a.编号 == item.编号).First();
            Assert.NotNull(item2);
            Assert.Equal(item.编号, item2.编号);
            Assert.Equal(item.标题, item2.标题);
        }