示例#1
0
        public void Save(string fileName)
        {
            Persistent.SakuraContext context = new Persistent.SakuraContext(fileName);
            context.Database.EnsureDeleted();
            context.Database.EnsureCreated();

            context.Items.AddRange(Items.Select(x => {
                Persistent.ItemModel model = new Persistent.ItemModel();
                Migrate(x, model);
                return(model);
            }));

            context.Morphs.AddRange(Morphs.Select(x => {
                Persistent.MorphModel model = new Persistent.MorphModel();
                Migrate(x, model);
                return(model);
            }));

            context.Messages.AddRange(Messages.Select(x => {
                Persistent.MessageModel model = new Persistent.MessageModel();
                Migrate(x, model);
                return(model);
            }));

            context.SaveChanges();
        }
示例#2
0
 protected virtual void OnInitialize()
 {
     Morphs
     .Select(CreateMorphPanel)
     .Where(p => p != null)
     .ToList()
     .ForEach(p => MorphsPanel.AddChild(p));
 }