Beispiel #1
0
 public BaseEventArgs()
 {
     this.map           = new MyDictionary <string, IParable>();
     this.directMap     = new MyDictionary <string, IParable>();
     this.units         = new GameUnitSet();
     this.temp          = new MyDictionary <string, Stack <IParable> >();
     this._functions    = new CommonActions();
     this._triggers     = new GameTriggers();
     this._componentMap = new GameComponentMap();
     this._components   = new GameComponents();
     this._bufs         = new FreeBufManager();
     this._freeContext  = new FreeContext(_gameContext);
 }
Beispiel #2
0
        public void Update()
        {
            //查询 1对多,再联级保存

            using (var ctx = new FreeContext(g.sqlite)) {
                var tag = ctx.Set <Tag>().Select.First();
                tag.Tags.Add(new Tag {
                    Name = "sub3"
                });
                ctx.Update(tag);
                ctx.SaveChanges();
            }
        }
Beispiel #3
0
        public void Add()
        {
            g.sqlite.SetDbContextOptions(opt =>
            {
                //opt.EnableAddOrUpdateNavigateList = false;
            });

            g.mysql.Insert <testenumWhere>().AppendData(new testenumWhere {
                type = testenumWhereType.Blaaa
            }).ExecuteAffrows();

            var sql    = g.mysql.Select <testenumWhere>().Where(a => a.type == testenumWhereType.Blaaa).ToSql();
            var tolist = g.mysql.Select <testenumWhere>().Where(a => a.type == testenumWhereType.Blaaa).ToList();

            //支持 1对多 级联保存

            using (var ctx = new FreeContext(g.sqlite))
            {
                var tags = ctx.Set <Tag>().Select.IncludeMany(a => a.Tags).ToList();

                var tag = new Tag
                {
                    Name = "testaddsublist",
                    Tags = new[] {
                        new Tag {
                            Name = "sub1"
                        },
                        new Tag {
                            Name = "sub2"
                        },
                        new Tag {
                            Name = "sub3",
                            Tags = new[] {
                                new Tag {
                                    Name = "sub3_01"
                                }
                            }
                        }
                    }
                };
                ctx.Add(tag);
                ctx.SaveChanges();
            }
        }