コード例 #1
0
        public void mysql乐观锁测试()
        {
            var sp = new Startup_RV().ConfigureServices(new ServiceCollection());
            var db = sp.GetService <RVDbContext>();
            //var m = new ModelA() { StringSetLength = "BBBB" };
            //db.ModelASet.Add(m);
            //m.Before();
            //db.SaveChanges();


            //m.StringMax = "stringmax";
            //m.Before();
            //db.SaveChanges();

            //var m = db.ModelASet.Find("201709191740078993");
            //m.StringDefault = "StringDefault";
            //m.Before();
            //db.SaveChanges();

            //var st = new ShardTable() {  DefaultName="DN"};
            //db.Set<ShardTable>().Add(st);
            //st.Before();
            //db.SaveChanges();

            var m = db.Set <ShardTable>().Find("201709191809163785");

            m.DecimalSacle += 99;

            ((ISaveEntityEvent)m).Before();
            db.SaveChanges();
        }
コード例 #2
0
ファイル: TestDbContext.cs プロジェクト: zhangbo27/Aquirrel
        public RVDbContext CreateDbContext(string[] args)
        {
            var sp = new Startup_RV().ConfigureServices(new ServiceCollection());
            var db = sp.GetService <RVDbContext>();

            Console.WriteLine("db is null? " + (db == null));
            return(db);
        }