예제 #1
0
        protected void nHydrateDiagram_DiagramAdded(object sender, Microsoft.VisualStudio.Modeling.ElementAddedEventArgs e)
        {
            if (_isLoaded)
            {
                return;
            }
            _isLoaded = true;

            var model = this.Diagram.ModelElement as nHydrateModel;

            //Notify when field is changed so we can refresh icon
            this.Store.EventManagerDirectory.ElementPropertyChanged.Add(
                this.Store.DomainDataDirectory.FindDomainClass(typeof(Field)),
                new EventHandler <Microsoft.VisualStudio.Modeling.ElementPropertyChangedEventArgs>(FieldPropertyChanged));

            this.Store.EventManagerDirectory.ElementPropertyChanged.Add(
                this.Store.DomainDataDirectory.FindDomainClass(typeof(ViewField)),
                new EventHandler <Microsoft.VisualStudio.Modeling.ElementPropertyChangedEventArgs>(ViewFieldPropertyChanged));

            //Notify when an index column is added
            this.Store.EventManagerDirectory.ElementAdded.Add(
                this.Store.DomainDataDirectory.FindDomainClass(typeof(IndexColumn)),
                new EventHandler <Microsoft.VisualStudio.Modeling.ElementAddedEventArgs>(IndexColumnAdded));

            //Notify when a Field is added
            this.Store.EventManagerDirectory.ElementAdded.Add(
                this.Store.DomainDataDirectory.FindDomainClass(typeof(Field)),
                new EventHandler <Microsoft.VisualStudio.Modeling.ElementAddedEventArgs>(FieldAdded));

            this.IsLoading = false;
            model.IsDirty  = true;
        }
예제 #2
0
        private void FieldAdded(object sender, Microsoft.VisualStudio.Modeling.ElementAddedEventArgs e)
        {
            var field = e.ModelElement as Field;

            if (field.Entity == null)
            {
                return;
            }
            if (field.Entity.nHydrateModel == null)
            {
                return;
            }

            if (!field.Entity.nHydrateModel.IsLoading && field.SortOrder == 0)
            {
                var maxSortOrder = 1;
                if (field.Entity.Fields.Count > 0)
                {
                    maxSortOrder = field.Entity.Fields.Max(x => x.SortOrder);
                }

                using (var transaction = this.Store.TransactionManager.BeginTransaction(Guid.NewGuid().ToString()))
                {
                    field.SortOrder = ++maxSortOrder;
                    transaction.Commit();
                }
            }
        }
예제 #3
0
 private void ElementAddHandler(object sender, Microsoft.VisualStudio.Modeling.ElementAddedEventArgs e)
 {
     if (_model.IsLoading)
     {
         return;
     }
     _findControl.SetupObjects(_model, _diagram, _docView);
 }
예제 #4
0
        protected override void OnElementAdded(Microsoft.VisualStudio.Modeling.ElementAddedEventArgs e)
        {
            var model = this.ModelElement as nHydrate.Dsl.nHydrateModel;

            if (!model.IsLoading)
            {
            }
            base.OnElementAdded(e);
        }
예제 #5
0
        private void OnElementAdded(object source, Microsoft.VisualStudio.Modeling.ElementAddedEventArgs e)
        {
            Microsoft.VisualStudio.Modeling.ModelElement m = e.ModelElement;

            // add key
            if (m is IDomainModelOwnable)
            {
                this.GetDomainModelServices(m as IDomainModelOwnable).ElementIdProvider.AddKey(m);
            }
        }
예제 #6
0
        private void IndexColumnAdded(object sender, Microsoft.VisualStudio.Modeling.ElementAddedEventArgs e)
        {
            var ic = e.ModelElement as IndexColumn;

            if (ic.Index == null)
            {
                return;
            }
            if (ic.Index.Entity == null)
            {
                return;
            }
            if (ic.Index.Entity.nHydrateModel == null)
            {
                return;
            }

            if (!ic.IsInternal && !ic.Index.Entity.nHydrateModel.IsLoading && !this.Store.InUndo)
            {
                if (!ic.Index.Entity.nHydrateModel.IsLoading)
                {
                    if (ic.Index.IndexType != IndexTypeConstants.User)
                    {
                        throw new Exception("This is a managed index and cannot be modified.");
                    }
                }
            }

            if (!ic.Index.Entity.nHydrateModel.IsLoading)
            {
                if (ic.SortOrder == 0)
                {
                    using (var transaction = this.Store.TransactionManager.BeginTransaction(Guid.NewGuid().ToString()))
                    {
                        var max = 0;
                        if (ic.Index.IndexColumns.Count > 0)
                        {
                            max = ic.Index.IndexColumns.Max(x => x.SortOrder);
                        }
                        ic.SortOrder = max + 1;
                        transaction.Commit();
                    }
                }
            }
        }
예제 #7
0
        protected override void OnElementAdded(Microsoft.VisualStudio.Modeling.ElementAddedEventArgs e)
        {
            var model = this.ModelElement as nHydrate.Dsl.nHydrateModel;

            if (!model.IsLoading)
            {
                if (e.ModelElement is IPrecedence)
                {
                    var element = e.ModelElement as IPrecedence;
                    using (var transaction = model.Store.TransactionManager.BeginTransaction(Guid.NewGuid().ToString()))
                    {
                        element.PrecedenceOrder = ++model.MaxPrecedenceOrder;
                        transaction.Commit();
                    }
                }
            }

            base.OnElementAdded(e);
        }
 public override void ElementAdded(Microsoft.VisualStudio.Modeling.ElementAddedEventArgs e)
 {
     ORMSolutions.ORMArchitect.Framework.Diagnostics.TraceUtility.TraceRuleStart(e.ModelElement.Store, "ORMSolutions.ORMArchitect.Framework.Shell.DiagramDisplay.DiagramAddedRule");
     DiagramDisplay.DiagramAddedRule(e);
     ORMSolutions.ORMArchitect.Framework.Diagnostics.TraceUtility.TraceRuleEnd(e.ModelElement.Store, "ORMSolutions.ORMArchitect.Framework.Shell.DiagramDisplay.DiagramAddedRule");
 }
예제 #9
0
        protected void nHydrateDiagram_DiagramAdded(object sender, Microsoft.VisualStudio.Modeling.ElementAddedEventArgs e)
        {
            if (_isLoaded)
            {
                return;
            }
            _isLoaded = true;

            var model = this.Diagram.ModelElement as nHydrateModel;

            if ((model.DiagramVisibility & VisibilityTypeConstants.StoredProcedure) == VisibilityTypeConstants.StoredProcedure)
            {
                this.Store.ElementDirectory.AllElements.Where(x => x is StoredProcedureShape).ToList().Cast <StoredProcedureShape>().ToList().ForEach(x => x.Show());
            }
            else
            {
                this.Store.ElementDirectory.AllElements.Where(x => x is StoredProcedureShape).ToList().Cast <StoredProcedureShape>().ToList().ForEach(x => x.Hide());
            }

            if ((model.DiagramVisibility & VisibilityTypeConstants.View) == VisibilityTypeConstants.View)
            {
                this.Store.ElementDirectory.AllElements.Where(x => x is ViewShape).ToList().Cast <ViewShape>().ToList().ForEach(x => x.Show());
            }
            else
            {
                this.Store.ElementDirectory.AllElements.Where(x => x is ViewShape).ToList().Cast <ViewShape>().ToList().ForEach(x => x.Hide());
            }

            if ((model.DiagramVisibility & VisibilityTypeConstants.Function) == VisibilityTypeConstants.Function)
            {
                this.Store.ElementDirectory.AllElements.Where(x => x is FunctionShape).ToList().Cast <FunctionShape>().ToList().ForEach(x => x.Show());
            }
            else
            {
                this.Store.ElementDirectory.AllElements.Where(x => x is FunctionShape).ToList().Cast <FunctionShape>().ToList().ForEach(x => x.Hide());
            }

            //Notify when field is changed so we can refresh icon
            this.Store.EventManagerDirectory.ElementPropertyChanged.Add(
                this.Store.DomainDataDirectory.FindDomainClass(typeof(Field)),
                new EventHandler <Microsoft.VisualStudio.Modeling.ElementPropertyChangedEventArgs>(FieldPropertyChanged));

            this.Store.EventManagerDirectory.ElementPropertyChanged.Add(
                this.Store.DomainDataDirectory.FindDomainClass(typeof(ViewField)),
                new EventHandler <Microsoft.VisualStudio.Modeling.ElementPropertyChangedEventArgs>(ViewFieldPropertyChanged));

            this.Store.EventManagerDirectory.ElementPropertyChanged.Add(
                this.Store.DomainDataDirectory.FindDomainClass(typeof(nHydrateModel)),
                new EventHandler <Microsoft.VisualStudio.Modeling.ElementPropertyChangedEventArgs>(DiagramViewablePropertyChanged));

            //Notify when an index column is added
            this.Store.EventManagerDirectory.ElementAdded.Add(
                this.Store.DomainDataDirectory.FindDomainClass(typeof(IndexColumn)),
                new EventHandler <Microsoft.VisualStudio.Modeling.ElementAddedEventArgs>(IndexColumnAdded));

            //Notify when a Field is added
            this.Store.EventManagerDirectory.ElementAdded.Add(
                this.Store.DomainDataDirectory.FindDomainClass(typeof(Field)),
                new EventHandler <Microsoft.VisualStudio.Modeling.ElementAddedEventArgs>(FieldAdded));

            //this.Store.EventManagerDirectory.ElementPropertyChanged.Add(
            //  new EventHandler<Microsoft.VisualStudio.Modeling.ElementPropertyChangedEventArgs>(AnyPropertyChangedHandler));

            this.IsLoading = false;
            model.IsDirty  = true;
        }
예제 #10
0
 public override void ElementAdded(Microsoft.VisualStudio.Modeling.ElementAddedEventArgs e)
 {
     ORMSolutions.ORMArchitect.Framework.Diagnostics.TraceUtility.TraceRuleStart(e.ModelElement.Store, "ORMSolutions.ORMArchitect.RelationalModels.ConceptualDatabase.ReferenceConstraint.UniquenessConstraintColumnAdded");
     ReferenceConstraint.UniquenessConstraintColumnAdded(e);
     ORMSolutions.ORMArchitect.Framework.Diagnostics.TraceUtility.TraceRuleEnd(e.ModelElement.Store, "ORMSolutions.ORMArchitect.RelationalModels.ConceptualDatabase.ReferenceConstraint.UniquenessConstraintColumnAdded");
 }
예제 #11
0
 public override void ElementAdded(Microsoft.VisualStudio.Modeling.ElementAddedEventArgs e)
 {
     ORMSolutions.ORMArchitect.Framework.Diagnostics.TraceUtility.TraceRuleStart(e.ModelElement.Store, "ORMSolutions.ORMArchitect.Framework.FrameworkDomainModel.DelayValidateElements");
     FrameworkDomainModel.DelayValidateElements(e);
     ORMSolutions.ORMArchitect.Framework.Diagnostics.TraceUtility.TraceRuleEnd(e.ModelElement.Store, "ORMSolutions.ORMArchitect.Framework.FrameworkDomainModel.DelayValidateElements");
 }
예제 #12
0
 public override void ElementAdded(Microsoft.VisualStudio.Modeling.ElementAddedEventArgs e)
 {
     ORMSolutions.ORMArchitect.Framework.Diagnostics.TraceUtility.TraceRuleStart(e.ModelElement.Store, "ORMSolutions.ORMArchitect.Views.BarkerERView.BarkerERDiagram.BinaryAssociationAddedRule");
     BarkerERDiagram.BinaryAssociationAddedRule(e);
     ORMSolutions.ORMArchitect.Framework.Diagnostics.TraceUtility.TraceRuleEnd(e.ModelElement.Store, "ORMSolutions.ORMArchitect.Views.BarkerERView.BarkerERDiagram.BinaryAssociationAddedRule");
 }
예제 #13
0
 public override void ElementAdded(Microsoft.VisualStudio.Modeling.ElementAddedEventArgs e)
 {
     ORMSolutions.ORMArchitect.Framework.Diagnostics.TraceUtility.TraceRuleStart(e.ModelElement.Store, "ORMSolutions.ORMArchitect.ORMAbstractionToBarkerERBridge.ORMAbstractionToBarkerERBridgeDomainModel.ModificationTracker.ConceptTypeAddedRule");
     ModificationTracker.ConceptTypeAddedRule(e);
     ORMSolutions.ORMArchitect.Framework.Diagnostics.TraceUtility.TraceRuleEnd(e.ModelElement.Store, "ORMSolutions.ORMArchitect.ORMAbstractionToBarkerERBridge.ORMAbstractionToBarkerERBridgeDomainModel.ModificationTracker.ConceptTypeAddedRule");
 }
예제 #14
0
 public override void ElementAdded(Microsoft.VisualStudio.Modeling.ElementAddedEventArgs e)
 {
     ORMSolutions.ORMArchitect.Framework.Diagnostics.TraceUtility.TraceRuleStart(e.ModelElement.Store, "ORMSolutions.ORMArchitect.Views.RelationalView.RelationalDiagram.ReferenceConstraintAddedRule");
     RelationalDiagram.ReferenceConstraintAddedRule(e);
     ORMSolutions.ORMArchitect.Framework.Diagnostics.TraceUtility.TraceRuleEnd(e.ModelElement.Store, "ORMSolutions.ORMArchitect.Views.RelationalView.RelationalDiagram.ReferenceConstraintAddedRule");
 }
예제 #15
0
 public override void ElementAdded(Microsoft.VisualStudio.Modeling.ElementAddedEventArgs e)
 {
     ORMSolutions.ORMArchitect.Framework.Diagnostics.TraceUtility.TraceRuleStart(e.ModelElement.Store, "ORMSolutions.ORMArchitect.ExtensionExample.ObjectTypeRequiresMeaningfulNameError.ExtensionObjectTypeAddRule");
     ObjectTypeRequiresMeaningfulNameError.ExtensionObjectTypeAddRule(e);
     ORMSolutions.ORMArchitect.Framework.Diagnostics.TraceUtility.TraceRuleEnd(e.ModelElement.Store, "ORMSolutions.ORMArchitect.ExtensionExample.ObjectTypeRequiresMeaningfulNameError.ExtensionObjectTypeAddRule");
 }
예제 #16
0
 public override void ElementAdded(Microsoft.VisualStudio.Modeling.ElementAddedEventArgs e)
 {
     ORMSolutions.ORMArchitect.Framework.Diagnostics.TraceUtility.TraceRuleStart(e.ModelElement.Store, "ORMSolutions.ORMArchitect.ExtensionExample.MyCustomExtensionElement.RoleAddRule");
     MyCustomExtensionElement.RoleAddRule(e);
     ORMSolutions.ORMArchitect.Framework.Diagnostics.TraceUtility.TraceRuleEnd(e.ModelElement.Store, "ORMSolutions.ORMArchitect.ExtensionExample.MyCustomExtensionElement.RoleAddRule");
 }