Exemple #1
0
        /// <summary>
        /// 强制保存
        /// </summary>
        public void SaveEntity()
        {
            if (MessageBox.Show("确认强制保存吗?\n要知道这存在一定破坏性!", "对象编辑", MessageBoxButton.YesNo) !=
                MessageBoxResult.Yes)
            {
                return;
            }
            ConfigWriter writer = new ConfigWriter
            {
                Solution  = Context.Solution,
                Directory = Path.GetDirectoryName(Context.Solution.FileName)
            };

            if (Context.SelectProject != null)
            {
                writer.SaveProject(Context.SelectProject, false);
                return;
            }
            var tables = Context.GetSelectEntities();

            foreach (var entity in tables)
            {
                writer.SaveEntity(entity, false);
            }
        }
        /// <summary>
        /// 强制保存
        /// </summary>
        public void SaveEntity(object arg)
        {
            ConfigWriter writer = new ConfigWriter
            {
                Solution = Context.Solution,
            };

            if (Context.SelectProject != null)
            {
                writer.SaveProject(Context.SelectProject, Path.GetDirectoryName(Context.Solution.SaveFileName));
                return;
            }
            var tables = Context.GetSelectEntities();

            foreach (var entity in tables)
            {
                writer.SaveEntity(entity, Path.GetDirectoryName(Context.Solution.SaveFileName), true);
            }
        }