예제 #1
0
        protected override void OnDocumentSaving(EventArgs e)
        {
            var diagram   = GetCurrentDiagram(this.Store);
            var modelRoot = diagram.ModelElement as ModelRoot;

            if (string.IsNullOrEmpty(modelRoot.ConnectionString))
            {
                using (var tx = diagram.Store.TransactionManager.BeginTransaction("Initialize", false))
                {
                    modelRoot.ConnectionString = ConnectionUtil.GetDefaultConnectionString(diagram.Name);
                    if (tx.HasPendingChanges)
                    {
                        tx.Commit();
                    }
                }
            }
            base.OnDocumentSaving(e);
        }