public UserDefinedScriptOrderForm(nHydrateModel model, Microsoft.VisualStudio.Modeling.Store store)
            : this()
        {
            _model = model;
            _store = store;

            if (_model.UseModules)
            {
                foreach (var module in _model.Modules)
                {
                    cboInstaller.Items.Add(this.DefaultNamespace + "." + module.Name + ".Install");
                }
            }
            else
            {
                cboInstaller.Items.Add(this.DefaultNamespace + ".Install");
            }

            if (cboInstaller.Items.Count > 0)
            {
                cboInstaller.SelectedIndex = 0;
            }
            else
            {
                MessageBox.Show("There are no modules in this model so no installer project can be selected.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            LoadItems();
        }
        public RefactorCombineTableForm(Microsoft.VisualStudio.Modeling.Store store, nHydrateDiagram diagram, nHydrateModel model, Entity entity1, Entity entity2)
            : this()
        {
            _store   = store;
            _model   = model;
            _diagram = diagram;
            _entity1 = entity1;
            _entity2 = entity2;

            lblEntity1.Text = entity1.Name;
            lblEntity2.Text = entity2.Name;

            var fieldList = new List <Field>();

            fieldList.AddRange(entity1.Fields);
            fieldList.AddRange(entity2.Fields);
            fieldList.Remove(x => entity2.PrimaryKeyFields.Contains(x));

            if (fieldList.Select(x => x.Name.ToLower()).Count() != fieldList.Select(x => x.Name.ToLower()).Distinct().Count())
            {
                cmdApply.Enabled = false;
                lblError.Text    = "Duplicate field names are not allowed.";
                lblError.Visible = true;
            }

            fieldList.ForEach(x => lstField.Items.Add(x.Name));
        }
		public RefactorCombineTableForm(Microsoft.VisualStudio.Modeling.Store store, nHydrateDiagram diagram, nHydrateModel model, Entity entity1, Entity entity2)
			: this()
		{
			_store = store;
			_model = model;
			_diagram = diagram;
			_entity1 = entity1;
			_entity2 = entity2;

			lblEntity1.Text = entity1.Name;
			lblEntity2.Text = entity2.Name;

			var fieldList = new List<Field>();
			fieldList.AddRange(entity1.Fields);
			fieldList.AddRange(entity2.Fields);
			fieldList.Remove(x => entity2.PrimaryKeyFields.Contains(x));

			if (fieldList.Select(x => x.Name.ToLower()).Count() != fieldList.Select(x => x.Name.ToLower()).Distinct().Count())
			{
				cmdApply.Enabled = false;
				lblError.Text = "Duplicate field names are not allowed.";
				lblError.Visible = true;
			}

			fieldList.ForEach(x => lstField.Items.Add(x.Name));
		}
 public ModelUtilitiesForm(nHydrateModel model, Microsoft.VisualStudio.Modeling.Store store, nHydrateDiagram diagram)
     : this()
 {
     _model   = model;
     _store   = store;
     _diagram = diagram;
 }
        public RefreshItemFromDatabase(
            nHydrateModel model,
            nHydrate.Dsl.IDatabaseEntity modelElement,
            Microsoft.VisualStudio.Modeling.Store store,
            Microsoft.VisualStudio.Modeling.Shell.ModelingDocData docData)
            : this()
        {
            if (modelElement == null)
                throw new Exception("Model element canot be null.");

            _model = model;
            _store = store;
            _modelElement = modelElement;
            _importDomain = new nHydrate.DataImport.SqlClient.ImportDomain();

            this.DatabaseConnectionControl1.FileName = Path.Combine((new FileInfo(docData.FileName)).DirectoryName, "importconnection.cache");
            DatabaseConnectionControl1.LoadSettings();

            //Setup new model
            _auditFields.Add(new SpecialField { Name = _model.CreatedByColumnName, Type = SpecialFieldTypeConstants.CreatedBy });
            _auditFields.Add(new SpecialField { Name = _model.CreatedDateColumnName, Type = SpecialFieldTypeConstants.CreatedDate });
            _auditFields.Add(new SpecialField { Name = _model.ModifiedByColumnName, Type = SpecialFieldTypeConstants.ModifiedBy });
            _auditFields.Add(new SpecialField { Name = _model.ModifiedDateColumnName, Type = SpecialFieldTypeConstants.ModifedDate });
            _auditFields.Add(new SpecialField { Name = _model.TimestampColumnName, Type = SpecialFieldTypeConstants.Timestamp });
            _auditFields.Add(new SpecialField { Name = _model.TenantColumnName, Type = SpecialFieldTypeConstants.Tenant });

            wizard1.FinishEnabled = false;

        }
Beispiel #6
0
 public StaticDataForm(Entity entity, Microsoft.VisualStudio.Modeling.Store store)
     : this()
 {
     _entity = entity;
     _store  = store;
     this.LoadData();
 }
		public UserDefinedScriptOrderForm(nHydrateModel model, Microsoft.VisualStudio.Modeling.Store store)
			: this()
		{
			_model = model;
			_store = store;

			if (_model.UseModules)
			{
				foreach (var module in _model.Modules)
				{
					cboInstaller.Items.Add(this.DefaultNamespace + "." + module.Name + ".Install");
				}
			}
			else
			{
				cboInstaller.Items.Add(this.DefaultNamespace + ".Install");
			}

			if (cboInstaller.Items.Count > 0)
				cboInstaller.SelectedIndex = 0;
			else
				MessageBox.Show("There are no modules in this model so no installer project can be selected.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

			LoadItems();
		}
        public RelationCollectionForm(
            nHydrateModel model,
            EntityShape entityShape,
            Microsoft.VisualStudio.Modeling.Store store,
            Microsoft.VisualStudio.Modeling.Diagrams.Diagram diagram,
            nHydrateDocData docData)
            : this()
        {
            _model       = model;
            _store       = store;
            _diagram     = diagram;
            _docData     = docData;
            _entityShape = entityShape;

            lvwMembers.Columns.Clear();
            lvwMembers.Columns.Add(new ColumnHeader()
            {
                Text = "Parent", Width = 200
            });
            lvwMembers.Columns.Add(new ColumnHeader()
            {
                Text = "Child", Width = 200
            });
            lvwMembers.Columns.Add(new ColumnHeader()
            {
                Text = "Role", Width = 200
            });

            lvwMembers.ListViewItemSorter = new nHydrate.Generator.Common.Forms.CommonLibrary.ListViewItemComparer(0, lvwMembers.Sorting);
            lvwMembers.Sort();

            this.LoadList();
        }
        protected override IList <Microsoft.VisualStudio.Modeling.ModelElement> BuildElementList(object component)
        {
            Microsoft.VisualStudio.Modeling.DomainClassInfo domainClassInfo = DomainRoleInfo.RolePlayer;
            if (domainClassInfo == null || component == null)
            {
                return(new System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement>());
            }

            Microsoft.VisualStudio.Modeling.Store store = this.GetStore(component);
            System.Collections.Generic.IList <Microsoft.VisualStudio.Modeling.ModelElement> ilist;
            if (component is ReferenceRelationship)
            {
                ilist = store.ElementDirectory.FindElements(ReferenceRelationship.DomainClassId);
            }
            else
            {
                ilist = store.ElementDirectory.FindElements(EmbeddingRelationship.DomainClassId);
            }
            System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement> list = new System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement>();

            DomainRelationship domainClass1 = component as DomainRelationship;

            foreach (Microsoft.VisualStudio.Modeling.ModelElement modelElement in ilist)
            {
                DomainRelationship domainClass2 = modelElement as DomainRelationship;
                if ((domainClass2 != null) && ShouldIncludeCandidate(domainClass1, domainClass2))
                {
                    list.Add(modelElement);
                }
            }
            return(list);
        }
Beispiel #10
0
            protected override IList <Microsoft.VisualStudio.Modeling.ModelElement> BuildElementList(object component)
            {
                Microsoft.VisualStudio.Modeling.DomainClassInfo domainClassInfo = DomainRoleInfo.RolePlayer;
                if (domainClassInfo == null || component == null)
                {
                    return(new System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement>());
                }

                Microsoft.VisualStudio.Modeling.Store store = this.GetStore(component);

                ExternModelContext externModelContext = component as ExternModelContext;

                System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement>  list  = new System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement>();
                System.Collections.Generic.IList <Microsoft.VisualStudio.Modeling.ModelElement> ilist = store.ElementDirectory.FindElements(domainClassInfo, true);
                foreach (Microsoft.VisualStudio.Modeling.ModelElement modelElement in ilist)
                {
                    BaseModelContext p = modelElement as BaseModelContext;
                    if (p.MetaModel.IsTopMost)
                    {
                        continue;
                    }

                    list.Add(p);
                }
                return(list);
            }
Beispiel #11
0
 public ModelUtilitiesForm(nHydrateModel model, Microsoft.VisualStudio.Modeling.Store store, nHydrateDiagram diagram)
     : this()
 {
     _model = model;
     _store = store;
     _diagram = diagram;
 }
		public RefactorRetypePkForm(Microsoft.VisualStudio.Modeling.Store store, nHydrateModel model, Entity entity)
			: this()
		{
			_store = store;
			_model = model;
			_entity = entity;

			foreach (var s in Enum.GetNames(typeof(DataTypeConstants)))
			{
				cboType.Items.Add(s);
			}

			cboType.SelectedItem = entity.PrimaryKeyFields.First().DataType.ToString();

			var tree = new Dictionary<EntityHasEntities, Field>();
			BuildRelationTree(entity, tree);

			var used = new List<string>();
			foreach (var r in tree.Keys)
			{
				var otherField = tree[r];
				var c = r.ParentEntity.Name + "." + otherField.Name;
				var p = r.ChildEntity.Name + "." + otherField.Name;
				if (!used.Contains(p))
				{
					lstItem.Items.Add(new RelationDisplay() { Display = p, Relation = r });
					used.Add(p);
				}
				if (!used.Contains(c))
				{
					lstItem.Items.Add(new RelationDisplay() { Display = c, Relation = r });
					used.Add(c);
				}
			}
		}
		public TableCompositeColumnForm(Composite composite, nHydrateModel model, Microsoft.VisualStudio.Modeling.Store store)
			: this()
		{
			_composite = composite;
			_model = model;
			_store = store;

			this.RefreshForm();
		}
 /// <summary>Implements IDomainModelEnablesRulesAfterDeserialization.EnableRulesAfterDeserialization</summary>
 protected void EnableRulesAfterDeserialization(Microsoft.VisualStudio.Modeling.Store store)
 {
     Microsoft.VisualStudio.Modeling.RuleManager ruleManager = store.RuleManager;
     Type[] disabledRuleTypes = DiagramDisplayDomainModel.CustomDomainModelTypes;
     for (int i = 0; i < 2; ++i)
     {
         ruleManager.EnableRule(disabledRuleTypes[i]);
     }
 }
Beispiel #15
0
        public TableCompositeColumnForm(Composite composite, nHydrateModel model, Microsoft.VisualStudio.Modeling.Store store)
            : this()
        {
            _composite = composite;
            _model     = model;
            _store     = store;

            this.RefreshForm();
        }
Beispiel #16
0
 /// <summary>Implements IDomainModelEnablesRulesAfterDeserialization.EnableRulesAfterDeserialization</summary>
 protected void EnableRulesAfterDeserialization(Microsoft.VisualStudio.Modeling.Store store)
 {
     Microsoft.VisualStudio.Modeling.RuleManager ruleManager = store.RuleManager;
     Type[] disabledRuleTypes = ORMAbstractionToBarkerERBridgeDomainModel.CustomDomainModelTypes;
     for (int i = 0; i < 4; ++i)
     {
         ruleManager.EnableRule(disabledRuleTypes[i]);
     }
 }
Beispiel #17
0
 public StaticDataForm(Entity entity, Microsoft.VisualStudio.Modeling.Store store, nHydrateModel model, Microsoft.VisualStudio.Modeling.Shell.ModelingDocData docData)
     : this()
 {
     _entity = entity;
     _store = store;
     _model = model;
     _docData = docData;
     this.LoadData();
 }
Beispiel #18
0
 public StaticDataForm(Entity entity, Microsoft.VisualStudio.Modeling.Store store, nHydrateModel model, Microsoft.VisualStudio.Modeling.Shell.ModelingDocData docData)
     : this()
 {
     _entity  = entity;
     _store   = store;
     _model   = model;
     _docData = docData;
     this.LoadData();
 }
Beispiel #19
0
 /// <summary>Implements IDomainModelEnablesRulesAfterDeserialization.EnableRulesAfterDeserialization</summary>
 protected void EnableRulesAfterDeserialization(Microsoft.VisualStudio.Modeling.Store store)
 {
     BarkerERShapeDomainModel.EnableDiagramRules(store);
     Microsoft.VisualStudio.Modeling.RuleManager ruleManager = store.RuleManager;
     Type[] disabledRuleTypes = BarkerERShapeDomainModel.InitiallyDisabledRuleTypes;
     for (int i = 0; i < 5; ++i)
     {
         ruleManager.EnableRule(disabledRuleTypes[i]);
     }
 }
        public ImportStaticDataForm(nHydrate.Dsl.Entity entity, Microsoft.VisualStudio.Modeling.Store store, Microsoft.VisualStudio.Modeling.Shell.ModelingDocData docData)
            : this()
        {
            _entity = entity;
            _store = store;

            lblWelcome.Text = "This wizard will walk you through the process of import static data from a database entity. The database entity schema must match the target function '" + entity.Name + "' in the modelRoot.";

            this.DatabaseConnectionControl1.FileName = Path.Combine((new FileInfo(docData.FileName)).DirectoryName, "importconnection.cache");
            DatabaseConnectionControl1.LoadSettings();
        }
 internal void UpdateFromStore(Microsoft.VisualStudio.Modeling.Store store)
 {
     try
     {
         DocViewPowerOverlay.UpdateFrom(store.ElementDirectory.AllElements, this.powerOverlay);
     }
     catch
     {
         this.IsPowerOverlayVisible = false;
     }
 }
Beispiel #22
0
        public ImportStaticDataForm(nHydrate.Dsl.Entity entity, Microsoft.VisualStudio.Modeling.Store store, Microsoft.VisualStudio.Modeling.Shell.ModelingDocData docData)
            : this()
        {
            _entity = entity;
            _store  = store;

            lblWelcome.Text = "This wizard will walk you through the process of import static data from a database entity. The database entity schema must match the target function '" + entity.Name + "' in the modelRoot.";

            this.DatabaseConnectionControl1.FileName = Path.Combine((new FileInfo(docData.FileName)).DirectoryName, "importconnection.cache");
            DatabaseConnectionControl1.LoadSettings();
        }
		public RefactorPreviewCreateAssociativeForm(Microsoft.VisualStudio.Modeling.Store store, nHydrateDiagram diagram, nHydrateModel model, Entity entity1, Entity entity2)
			: this()
		{
			_store = store;
			_model = model;
			_diagram = diagram;
			_entity1 = entity1;
			_entity2 = entity2;

			lblEntity1.Text = entity1.Name;
			lblEntity2.Text = entity2.Name;
			txtName.Text = _entity1.Name + _entity2.Name;
		}
Beispiel #24
0
        public StorePropertyBag(Microsoft.VisualStudio.Modeling.Store store, string propertyBagKey, object propertyBagValue)
        {
            this.store          = store;
            this.propertyBagKey = propertyBagKey;

            object value;

            if (!this.store.PropertyBag.TryGetValue(propertyBagKey, out value))
            {
                this.ownedKey = true;
                this.store.PropertyBag[this.propertyBagKey] = propertyBagValue;
            }
        }
        public StorePropertyBag(Microsoft.VisualStudio.Modeling.Store store, string propertyBagKey, object propertyBagValue)
        {
            this.store = store;
            this.propertyBagKey = propertyBagKey;

            object value;

            if (!this.store.PropertyBag.TryGetValue(propertyBagKey, out value))
            {
                this.ownedKey = true;
                this.store.PropertyBag[this.propertyBagKey] = propertyBagValue;
            }
        }
        public RefactorPreviewCreateAssociativeForm(Microsoft.VisualStudio.Modeling.Store store, nHydrateDiagram diagram, nHydrateModel model, Entity entity1, Entity entity2)
            : this()
        {
            _store   = store;
            _model   = model;
            _diagram = diagram;
            _entity1 = entity1;
            _entity2 = entity2;

            lblEntity1.Text = entity1.Name;
            lblEntity2.Text = entity2.Name;
            txtName.Text    = _entity1.Name + _entity2.Name;
        }
Beispiel #27
0
            protected override IList <Microsoft.VisualStudio.Modeling.ModelElement> BuildElementList(object component)
            {
                Microsoft.VisualStudio.Modeling.DomainClassInfo domainClassInfo = DomainRoleInfo.RolePlayer;
                if (domainClassInfo == null || component == null)
                {
                    return(new System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement>());
                }

                Microsoft.VisualStudio.Modeling.Store store = this.GetStore(component);

                System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement> list = new System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement>();
                DomainProperty domainProperty = component as DomainProperty;

                if (domainProperty == null)
                {
                    if (component is IList)
                    {
                        if ((component as IList).Count > 0)
                        {
                            domainProperty = (component as IList)[0] as DomainProperty;
                        }
                    }
                }

                if (domainProperty != null)
                {
                    list.AddRange(domainProperty.Element.ParentModelContext.MetaModel.DomainTypes);

                    System.Collections.Generic.IList <Microsoft.VisualStudio.Modeling.ModelElement> ilist = store.ElementDirectory.FindElements(domainClassInfo, true);
                    foreach (Microsoft.VisualStudio.Modeling.ModelElement modelElement in ilist)
                    {
                        DomainType p      = modelElement as DomainType;
                        bool       bFound = false;
                        foreach (DomainType e in list)
                        {
                            if (e.Name == p.Name &&
                                e.Namespace == p.Namespace)
                            {
                                bFound = true;
                                break;
                            }
                        }

                        if (!bFound)
                        {
                            list.Add(p);
                        }
                    }
                }
                return(list);
            }
		public RefactorSplitTableForm(Microsoft.VisualStudio.Modeling.Store store, nHydrateDiagram diagram, nHydrateModel model, Entity entity)
			: this()
		{
			_store = store;
			_model = model;
			_diagram = diagram;
			_entity = entity;
			wizard1.FinishEnabled = false;
			lblSourceEntity.Text = entity.Name;

			foreach (var field in entity.Fields.Where(x => !x.IsPrimaryKey).OrderBy(x => x.Name))
			{
				lstField1.Items.Add(new DisplayFieldItem() { Field = field });
			}
		}
        public RefactorSplitTableForm(Microsoft.VisualStudio.Modeling.Store store, nHydrateDiagram diagram, nHydrateModel model, Entity entity)
            : this()
        {
            _store   = store;
            _model   = model;
            _diagram = diagram;
            _entity  = entity;
            wizard1.FinishEnabled = false;
            lblSourceEntity.Text  = entity.Name;

            foreach (var field in entity.Fields.Where(x => !x.IsPrimaryKey).OrderBy(x => x.Name))
            {
                lstField1.Items.Add(new DisplayFieldItem()
                {
                    Field = field
                });
            }
        }
Beispiel #30
0
        public RefactorRetypePkForm(Microsoft.VisualStudio.Modeling.Store store, nHydrateModel model, Entity entity)
            : this()
        {
            _store  = store;
            _model  = model;
            _entity = entity;

            foreach (var s in Enum.GetNames(typeof(DataTypeConstants)))
            {
                cboType.Items.Add(s);
            }

            cboType.SelectedItem = entity.PrimaryKeyFields.First().DataType.ToString();

            var tree = new Dictionary <EntityHasEntities, Field>();

            BuildRelationTree(entity, tree);

            var used = new List <string>();

            foreach (var r in tree.Keys)
            {
                var otherField = tree[r];
                var c          = r.ParentEntity.Name + "." + otherField.Name;
                var p          = r.ChildEntity.Name + "." + otherField.Name;
                if (!used.Contains(p))
                {
                    lstItem.Items.Add(new RelationDisplay()
                    {
                        Display = p, Relation = r
                    });
                    used.Add(p);
                }
                if (!used.Contains(c))
                {
                    lstItem.Items.Add(new RelationDisplay()
                    {
                        Display = c, Relation = r
                    });
                    used.Add(c);
                }
            }
        }
        public RefactorPreviewChangeVarcharForm(Microsoft.VisualStudio.Modeling.Store store, nHydrateModel model, List<Microsoft.VisualStudio.Modeling.ModelElement> list)
            : this()
        {
            _store = store;
            _model = model;
            _list = list;

            //If the list is null then this use the whole model
            if (_list == null)
            {
                _list = new List<Microsoft.VisualStudio.Modeling.ModelElement>();
                _list.AddRange(_model.Entities);
                _list.AddRange(_model.Views);
                _list.AddRange(_model.StoredProcedures);
                _list.AddRange(_model.Functions);
            }

            this.Populate();
        }
Beispiel #32
0
        public RefactorPreviewChangeVarcharForm(Microsoft.VisualStudio.Modeling.Store store, nHydrateModel model, List <Microsoft.VisualStudio.Modeling.ModelElement> list)
            : this()
        {
            _store = store;
            _model = model;
            _list  = list;

            //If the list is null then this use the whole model
            if (_list == null)
            {
                _list = new List <Microsoft.VisualStudio.Modeling.ModelElement>();
                _list.AddRange(_model.Entities);
                _list.AddRange(_model.Views);
                _list.AddRange(_model.StoredProcedures);
                _list.AddRange(_model.Functions);
            }

            this.Populate();
        }
Beispiel #33
0
        public RefreshItemFromDatabase(
            nHydrateModel model,
            nHydrate.Dsl.IDatabaseEntity modelElement,
            Microsoft.VisualStudio.Modeling.Store store,
            Microsoft.VisualStudio.Modeling.Shell.ModelingDocData docData)
            : this()
        {
            if (modelElement == null)
            {
                throw new Exception("Model element canot be null.");
            }

            _model        = model;
            _store        = store;
            _modelElement = modelElement;
            _importDomain = new nHydrate.DataImport.SqlClient.ImportDomain();

            this.DatabaseConnectionControl1.FileName = Path.Combine((new FileInfo(docData.FileName)).DirectoryName, "importconnection.cache");
            DatabaseConnectionControl1.LoadSettings();

            //Setup new model
            _auditFields.Add(new SpecialField {
                Name = _model.CreatedByColumnName, Type = SpecialFieldTypeConstants.CreatedBy
            });
            _auditFields.Add(new SpecialField {
                Name = _model.CreatedDateColumnName, Type = SpecialFieldTypeConstants.CreatedDate
            });
            _auditFields.Add(new SpecialField {
                Name = _model.ModifiedByColumnName, Type = SpecialFieldTypeConstants.ModifiedBy
            });
            _auditFields.Add(new SpecialField {
                Name = _model.ModifiedDateColumnName, Type = SpecialFieldTypeConstants.ModifedDate
            });
            _auditFields.Add(new SpecialField {
                Name = _model.TimestampColumnName, Type = SpecialFieldTypeConstants.Timestamp
            });
            _auditFields.Add(new SpecialField {
                Name = _model.TenantColumnName, Type = SpecialFieldTypeConstants.Tenant
            });

            wizard1.FinishEnabled = false;
        }
            public void Initialize()
            {
                this.storeFilePath = Path.Combine(Path.GetTempPath(), Path.GetTempFileName());

                var toolkit = Mocks.Of <IInstalledToolkitInfo>().First(
                    x => x.Id == "test_toolkit" && x.Schema.Pattern.Id == Guid.NewGuid());

                this.productInfo = toolkit.Schema.Pattern;

                var productMock = Mock.Get(this.productInfo);

                productMock.Setup(x => x.Views)
                .Returns(Mocks.Of <IViewInfo>(x => x.Id == Guid.NewGuid() && x.Pattern == this.productInfo).Take(2).ToList());
                productMock.Setup(x => x.Properties)
                .Returns(Mocks.Of <IPropertyInfo>(x =>
                                                  x.Id == Guid.NewGuid() &&
                                                  x.Name == "Foo" + Guid.NewGuid() &&
                                                  x.Type == "System.String" &&
                                                  x.Parent == this.productInfo).Take(2).ToList());

                var serviceProvider = new Mock <IServiceProvider>();

                serviceProvider.Setup(x => x.GetService(typeof(IPatternManager)))
                .Returns(Mocks.Of <IPatternManager>().First(x => x.InstalledToolkits == new[] { toolkit }));

                using (var store = new Microsoft.VisualStudio.Modeling.Store(serviceProvider.Object, typeof(Microsoft.VisualStudio.Modeling.CoreDomainModel), typeof(ProductStateStoreDomainModel)))
                    using (var tx = store.TransactionManager.BeginTransaction())
                    {
                        var productStore = store.ElementFactory.CreateElement <ProductState>();

                        var product = productStore
                                      .CreateProduct(x => { x.ExtensionId = "test_toolkit"; x.DefinitionId = toolkit.Schema.Pattern.Id; });

                        this.productId = product.Id;

                        ProductStateStoreSerializationHelper.Instance.SaveModel(new Microsoft.VisualStudio.Modeling.SerializationResult(), productStore, this.storeFilePath);
                        tx.Commit();
                    }

                this.store = new Microsoft.VisualStudio.Modeling.Store(serviceProvider.Object, typeof(Microsoft.VisualStudio.Modeling.CoreDomainModel), typeof(ProductStateStoreDomainModel));
            }
        public RelationshipDialog(nHydrateModel model, Microsoft.VisualStudio.Modeling.Store store, EntityHasEntities connector, bool allowConfigure)
            : this()
        {
            try
            {
                _connector         = connector;
                _model             = model;
                _store             = store;
                _allowConfigure    = allowConfigure;
                chkEnforce.Visible = !model.UseModules;

                //Load the Form
                var parent = connector.ParentEntity;
                lblPrimaryTable.Text = parent.Name;

                if (!allowConfigure)
                {
                    lblSecondaryTable.Text = connector.ChildEntity.Name;
                }

                LoadRelation();

                if (_allowConfigure)
                {
                    cboChildTable.Items.Clear();
                    foreach (var entity in _model.Entities.OrderBy(x => x.Name))
                    {
                        cboChildTable.Items.Add(entity.Name);
                    }

                    lblSecondaryTable.Visible = false;
                    cboChildTable.Visible     = true;
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Beispiel #36
0
		public RelationshipDialog(nHydrateModel model, Microsoft.VisualStudio.Modeling.Store store, EntityHasEntities connector, bool allowConfigure)
			: this()
		{
			try
			{
				_connector = connector;
				_model = model;
				_store = store;
				_allowConfigure = allowConfigure;
				chkEnforce.Visible = !model.UseModules;

				//Load the Form
				var parent = connector.ParentEntity;
				lblPrimaryTable.Text = parent.Name;
				
				if (!allowConfigure)
					lblSecondaryTable.Text = connector.ChildEntity.Name;

				LoadRelation();

				if (_allowConfigure)
				{
					cboChildTable.Items.Clear();
					foreach (var entity in _model.Entities.OrderBy(x => x.Name))
					{
						cboChildTable.Items.Add(entity.Name);
					}

					lblSecondaryTable.Visible = false;
					cboChildTable.Visible = true;
				}

			}
			catch (Exception ex)
			{
				throw;
			}
		}
            protected override IList <Microsoft.VisualStudio.Modeling.ModelElement> BuildElementList(object component)
            {
                Microsoft.VisualStudio.Modeling.DomainClassInfo domainClassInfo = DomainRoleInfo.RolePlayer;
                if (domainClassInfo == null || component == null)
                {
                    return(new System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement>());
                }

                Microsoft.VisualStudio.Modeling.Store store = this.GetStore(component);

                DomainRole domainRole = component as DomainRole;

                System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement> list = new System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement>();
                list.AddRange(domainRole.Relationship.GetMetaModel().PropertyGridEditors);

                System.Collections.Generic.IList <Microsoft.VisualStudio.Modeling.ModelElement> ilist = store.ElementDirectory.FindElements(domainClassInfo, false);
                foreach (Microsoft.VisualStudio.Modeling.ModelElement modelElement in ilist)
                {
                    PropertyGridEditor p = modelElement as PropertyGridEditor;
                    bool bFound          = false;
                    foreach (PropertyGridEditor e in list)
                    {
                        if (e.Name == p.Name)
                        {
                            bFound = true;
                            break;
                        }
                    }

                    if (!bFound)
                    {
                        list.Add(p);
                    }
                }
                return(list);
            }
		public RelationCollectionForm(
			nHydrateModel model, 
			EntityShape entityShape,
			Microsoft.VisualStudio.Modeling.Store store, 
			Microsoft.VisualStudio.Modeling.Diagrams.Diagram diagram,
			nHydrateDocData docData)
			: this()
		{
			_model = model;
			_store = store;
			_diagram = diagram;
			_docData = docData;
			_entityShape = entityShape;

			lvwMembers.Columns.Clear();
			lvwMembers.Columns.Add(new ColumnHeader() { Text = "Parent", Width = 200 });
			lvwMembers.Columns.Add(new ColumnHeader() { Text = "Child", Width = 200 });
			lvwMembers.Columns.Add(new ColumnHeader() { Text = "Role", Width = 200 });

			lvwMembers.ListViewItemSorter = new nHydrate.Generator.Common.Forms.CommonLibrary.ListViewItemComparer(0, lvwMembers.Sorting);
			lvwMembers.Sort();

			this.LoadList();
		}
Beispiel #39
0
        public static bool Validate(nHydrateDocData docData, Microsoft.VisualStudio.Modeling.Store store, nHydrateModel model)
        {
            var key = ProgressHelper.ProgressingStarted("Verifying Model...");

            try
            {
                var validationController = docData.ValidationController;
                validationController.Validate(model.Entities, Microsoft.VisualStudio.Modeling.Validation.ValidationCategories.Custom);
                return(validationController.Validate(store, Microsoft.VisualStudio.Modeling.Validation.ValidationCategories.Custom |
                                                     Microsoft.VisualStudio.Modeling.Validation.ValidationCategories.Load |
                                                     Microsoft.VisualStudio.Modeling.Validation.ValidationCategories.Menu |
                                                     Microsoft.VisualStudio.Modeling.Validation.ValidationCategories.Open |
                                                     Microsoft.VisualStudio.Modeling.Validation.ValidationCategories.Save));
            }
            catch (Exception ex)
            {
                ProgressHelper.ProgressingComplete(key);
                throw;
            }
            finally
            {
                ProgressHelper.ProgressingComplete(key);
            }
        }
            public void Initialize()
            {
                var serviceProvider = Mocks.Of<IServiceProvider>().First(provider =>
                        provider.GetService(typeof(IPatternManager)) == Mocks.Of<IPatternManager>().First(manager =>
                        manager.InstalledToolkits == new IInstalledToolkitInfo[]
                        {
                            Mocks.Of<IInstalledToolkitInfo>().First(toolkitInfo =>
                                toolkitInfo.Id == Ids.ExtensionToolkit1Id &&
                                toolkitInfo.Schema.Pattern.Id == Ids.ExtensionProduct1Id &&
                                toolkitInfo.Schema.Pattern.Name == "Product1" &&
                                toolkitInfo.Schema.Pattern.ExtensionId == Ids.ExtensionToolkit1Id &&
                                toolkitInfo.Schema.Pattern.OrderGroup == 7 &&
                                toolkitInfo.Schema.Pattern.ProvidedExtensionPoints == new[]
                                {
                                    Mocks.Of<IProvidedExtensionPointInfo>().First(extensionPoint => extensionPoint.ExtensionPointId == "ExtensionPoint1Id")
                                }),
                            Mocks.Of<IInstalledToolkitInfo>().First(toolkitInfo =>
                                toolkitInfo.Id == Ids.ExtensionToolkit2Id &&
                                toolkitInfo.Schema.Pattern.Id == Ids.ExtensionProduct2Id &&
                                toolkitInfo.Schema.Pattern.Name == "Product2" &&
                                toolkitInfo.Schema.Pattern.ExtensionId == Ids.ExtensionToolkit2Id &&
                                toolkitInfo.Schema.Pattern.OrderGroup == 8 &&
                                toolkitInfo.Schema.Pattern.ProvidedExtensionPoints == new[]
                                {
                                    Mocks.Of<IProvidedExtensionPointInfo>().First(extensionPoint => extensionPoint.ExtensionPointId == "ExtensionPoint2Id")
                                }),
                            Mocks.Of<IInstalledToolkitInfo>().First(toolkitInfo =>
                                toolkitInfo.Id == Ids.MainToolkitId &&
                                toolkitInfo.Schema.Pattern.Id == Ids.MainProductId &&
                                toolkitInfo.Schema.Pattern.Name == "MainProduct" &&
                                toolkitInfo.Schema.Pattern.ExtensionId == Ids.MainToolkitId &&
                                toolkitInfo.Schema.Pattern.Views == new []
                                {
                                    //MainProduct
                                    //  View
                                    //      MainElement
                                    //          Collection1
                                    //              Property1
                                    //          Collection2
                                    //          Element1
                                    //          Element2
                                    //          Element3
                                    //          ExtensionPoint1
                                    //          ExtensionPoint2
                                    Mocks.Of<IViewInfo>().First(view =>
                                        view.Id == Ids.MainViewId &&
                                        view.Name == "View" &&
                                        view.Elements == new IAbstractElementInfo[]
                                        {
                                            Mocks.Of<IElementInfo>().First(element =>
                                                element.Id == Ids.MainElementId &&
                                                element.Name == "MainElement" &&
                                                element.Cardinality == Cardinality.ZeroToMany &&
                                                element.Elements == new IAbstractElementInfo[]
                                                {
                                                    Mocks.Of<ICollectionInfo>().First(ce =>
                                                        ce.Id == Ids.Collection1Id &&
                                                        ce.Name == "Collection1" &&
                                                        ce.OrderGroup == 1 &&
                                                        ce.Cardinality == Cardinality.ZeroToMany &&
                                                        ce.Properties == new [] {Mocks.Of<IPropertyInfo>().First(p =>
                                                            p.Name == "Property1" &&
                                                            p.Id == Ids.Property1Id &&
                                                            p.Type == typeof(string).FullName)}
                                                        ),
                                                    Mocks.Of<ICollectionInfo>().First(ce =>
                                                        ce.Id == Ids.Collection2Id &&
                                                        ce.Name == "Collection2" &&
                                                        ce.OrderGroup == 1 &&
                                                        ce.Cardinality == Cardinality.ZeroToMany
                                                        ),
                                                    Mocks.Of<IElementInfo>().First(ce =>
                                                        ce.Id == Ids.Element1Id &&
                                                        ce.Name == "Element1" &&
                                                        ce.OrderGroup == 2 &&
                                                        ce.Cardinality == Cardinality.ZeroToMany
                                                        ),
                                                    Mocks.Of<IElementInfo>().First(ce =>
                                                        ce.Id == Ids.Element2Id &&
                                                        ce.Name == "Element2" &&
                                                        ce.OrderGroup == 3 &&
                                                        ce.Cardinality == Cardinality.ZeroToMany
                                                        ),
                                                } &&
                                                element.ExtensionPoints == new IExtensionPointInfo[]
                                                {
                                                    Mocks.Of<IExtensionPointInfo>().First(extensionPoint =>
                                                        extensionPoint.Id == Ids.ExtensionPoint1Id &&
                                                        extensionPoint.Name == "ExtensionPoint1" &&
                                                        extensionPoint.OrderGroup == 4 &&
                                                        extensionPoint.Cardinality == Cardinality.ZeroToMany &&
                                                        extensionPoint.RequiredExtensionPointId == "ExtensionPoint1Id"
                                                        ),
                                                    Mocks.Of<IExtensionPointInfo>().First(extensionPoint =>
                                                        extensionPoint.Id == Ids.ExtensionPoint2Id &&
                                                        extensionPoint.Name == "ExtensionPoint2" &&
                                                        extensionPoint.OrderGroup == 5 &&
                                                        extensionPoint.Cardinality == Cardinality.ZeroToMany &&
                                                        extensionPoint.RequiredExtensionPointId == "ExtensionPoint2Id"
                                                        ),
                                                }),
                                        }),
                                }),
                        })
                    );

                using (var store = new Microsoft.VisualStudio.Modeling.Store(serviceProvider, typeof(Microsoft.VisualStudio.Modeling.CoreDomainModel), typeof(ProductStateStoreDomainModel)))
                using (var tx = store.TransactionManager.BeginTransaction())
                {
                    var productStore = store.ElementFactory.CreateElement<ProductState>();
                    productStore
                        .CreateProduct(p => { p.ExtensionId = Ids.MainToolkitId; p.DefinitionId = Ids.MainProductId; })
                        .CreateView(v => v.DefinitionId = Ids.MainViewId)
                        .CreateElement(e => e.DefinitionId = Ids.MainElementId);

                    ProductStateStoreSerializationHelper.Instance.SaveModel(new Microsoft.VisualStudio.Modeling.SerializationResult(), productStore, this.storeFilePath);
                    tx.Commit();
                }

                this.store = new Microsoft.VisualStudio.Modeling.Store(serviceProvider, typeof(Microsoft.VisualStudio.Modeling.CoreDomainModel), typeof(ProductStateStoreDomainModel));
                using (var tx = this.store.TransactionManager.BeginTransaction("Loading", true))
                {
                    ProductStateStoreSerializationHelper.Instance.LoadModel(this.store, this.storeFilePath, null, null, null);
                    tx.Commit();

                    this.productStore = this.store.ElementDirectory.AllElements.OfType<ProductState>().First();
                }

                this.mainElement = this.store.ElementDirectory.FindElements<Element>(true).First();
                this.view = this.store.ElementDirectory.FindElements<View>(true).First();
            }
        public RefactorPreviewChangeNTextForm(Microsoft.VisualStudio.Modeling.Store store, nHydrateModel model, List<Microsoft.VisualStudio.Modeling.ModelElement> list)
            : this()
        {
            _store = store;
            _model = model;

            this.DoShow = false;

            if (list == null)
            {
                list = new List<Microsoft.VisualStudio.Modeling.ModelElement>();
                list.AddRange(model.Entities);
                list.AddRange(model.Views);
                list.AddRange(model.StoredProcedures);
                list.AddRange(model.Functions);
            }

            //Create root nodes
            var entityListNode = new TreeNode() { Text = "Entities" };
            var viewListNode = new TreeNode() { Text = "Views" };
            var storedProcedureListNode = new TreeNode() { Text = "Stored Procedures" };
            var functionListNode = new TreeNode() { Text = "Functions" };

            #region Entities
            foreach (var item in model.Entities.Where(x => list.Contains(x)))
            {
                var fieldList = item.Fields.Where(x => x.DataType == DataTypeConstants.NText || x.DataType == DataTypeConstants.Text || x.DataType == DataTypeConstants.Image).ToList();
                if (fieldList.Count > 0)
                {
                    //Add entity node
                    var objectNode = new TreeNode() { Text = item.Name };
                    entityListNode.Nodes.Add(objectNode);

                    //Add fields node
                    var fieldListNode = new TreeNode() { Text = "Fields" };
                    objectNode.Nodes.Add(fieldListNode);

                    foreach (var field in fieldList)
                    {
                        var fieldNode = new TreeNode() { Text = field.Name + " (" + field.DataType.ToString() + ")", Tag = field, Checked = true };
                        fieldListNode.Nodes.Add(fieldNode);
                        this.DoShow = true;
                    }
                }
            }
            #endregion

            #region Views
            foreach (var item in model.Views.Where(x => list.Contains(x)))
            {
                var fieldList = item.Fields.Where(x => x.DataType == DataTypeConstants.NText || x.DataType == DataTypeConstants.Text || x.DataType == DataTypeConstants.Image).ToList();
                if (fieldList.Count > 0)
                {
                    //Add view node
                    var objectNode = new TreeNode() { Text = item.Name };
                    viewListNode.Nodes.Add(objectNode);

                    //Add fields node
                    var fieldListNode = new TreeNode() { Text = "Fields" };
                    objectNode.Nodes.Add(fieldListNode);

                    foreach (var field in fieldList)
                    {
                        var fieldNode = new TreeNode() { Text = field.Name + " (" + field.DataType.ToString() + ")", Tag = field, Checked = true };
                        fieldListNode.Nodes.Add(fieldNode);
                        this.DoShow = true;
                    }
                }
            }
            #endregion

            #region Stored Procedures
            foreach (var item in model.StoredProcedures.Where(x => list.Contains(x)))
            {
                var fieldList = item.Fields.Where(x => x.DataType == DataTypeConstants.NText || x.DataType == DataTypeConstants.Text || x.DataType == DataTypeConstants.Image).ToList();
                var parameterList = item.Parameters.Where(x => x.DataType == DataTypeConstants.NText || x.DataType == DataTypeConstants.Text || x.DataType == DataTypeConstants.Image).ToList();
                if (fieldList.Count + parameterList.Count > 0)
                {
                    //Add Stored Procedure node
                    var objectNode = new TreeNode() { Text = item.Name };
                    storedProcedureListNode.Nodes.Add(objectNode);

                    if (parameterList.Count > 0)
                    {
                        //Add parameters node
                        var parameterListNode = new TreeNode() { Text = "Parameters" };
                        objectNode.Nodes.Add(parameterListNode);

                        foreach (var parameter in parameterList)
                        {
                            var parameterNode = new TreeNode() { Text = parameter.Name + " (" + parameter.DataType.ToString() + ")", Tag = parameter, Checked = true };
                            parameterListNode.Nodes.Add(parameterNode);
                            this.DoShow = true;
                        }
                    }

                    if (fieldList.Count > 0)
                    {
                        //Add fields node
                        var fieldListNode = new TreeNode() { Text = "Fields" };
                        objectNode.Nodes.Add(fieldListNode);

                        foreach (var field in fieldList)
                        {
                            var fieldNode = new TreeNode() { Text = field.Name + " (" + field.DataType.ToString() + ")", Tag = field, Checked = true };
                            fieldListNode.Nodes.Add(fieldNode);
                            this.DoShow = true;
                        }
                    }

                }
            }
            #endregion

            #region Functions
            foreach (var item in model.Functions.Where(x => list.Contains(x)))
            {
                var fieldList = item.Fields.Where(x => x.DataType == DataTypeConstants.NText || x.DataType == DataTypeConstants.Text || x.DataType == DataTypeConstants.Image).ToList();
                var parameterList = item.Parameters.Where(x => x.DataType == DataTypeConstants.NText || x.DataType == DataTypeConstants.Text || x.DataType == DataTypeConstants.Image).ToList();
                if (fieldList.Count + parameterList.Count > 0)
                {
                    //Add Function node
                    var objectNode = new TreeNode() { Text = item.Name };
                    functionListNode.Nodes.Add(objectNode);

                    if (parameterList.Count > 0)
                    {
                        //Add parameters node
                        var parameterListNode = new TreeNode() { Text = "Parameters" };
                        objectNode.Nodes.Add(parameterListNode);

                        foreach (var parameter in parameterList)
                        {
                            var parameterNode = new TreeNode() { Text = parameter.Name + " (" + parameter.DataType.ToString() + ")", Tag = parameter, Checked = true };
                            parameterListNode.Nodes.Add(parameterNode);
                            this.DoShow = true;
                        }
                    }

                    if (fieldList.Count > 0)
                    {
                        //Add fields node
                        var fieldListNode = new TreeNode() { Text = "Fields" };
                        objectNode.Nodes.Add(fieldListNode);

                        foreach (var field in fieldList)
                        {
                            var fieldNode = new TreeNode() { Text = field.Name + " (" + field.DataType.ToString() + ")", Tag = field, Checked = true };
                            fieldListNode.Nodes.Add(fieldNode);
                            this.DoShow = true;
                        }
                    }

                }
            }
            #endregion

            //Add the root nodes if need be
            if (entityListNode.Nodes.Count > 0) tvwItem.Nodes.Add(entityListNode);
            if (viewListNode.Nodes.Count > 0) tvwItem.Nodes.Add(viewListNode);
            if (storedProcedureListNode.Nodes.Count > 0) tvwItem.Nodes.Add(storedProcedureListNode);
            if (functionListNode.Nodes.Count > 0) tvwItem.Nodes.Add(functionListNode);

            tvwItem.AfterCheck += new TreeViewEventHandler(tvwItem_AfterCheck);
            SetupStatus();
        }
 //Constructors were not generated for this class because it had HasCustomConstructor
 //set to true. Please provide the constructors below in a partial class.
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="store">Store where new element is to be created.</param>
 /// <param name="propertyAssignments">List of domain property id/value pairs to set once the element is created.</param>
 public nHydrateDiagram(Microsoft.VisualStudio.Modeling.Store store, params Microsoft.VisualStudio.Modeling.PropertyAssignment[] propertyAssignments)
     : this(store != null ? store.DefaultPartitionForClass(DomainClassId) : null, propertyAssignments)
 {
 }
            public void Initialize()
            {
                this.storeFilePath = Path.Combine(Path.GetTempPath(), Path.GetTempFileName());

                var viewInfoMock = new Mock<IViewInfo>();
                viewInfoMock.Setup(x => x.Id).Returns(Guid.NewGuid());
                viewInfoMock.Setup(e => e.Elements)
                    .Returns(new List<IAbstractElementInfo>
                    {
                        Mocks.Of<IElementInfo>().First(e => e.Id == Guid.NewGuid() && e.Cardinality == Cardinality.OneToOne && e.AutoCreate == true),
                        Mocks.Of<ICollectionInfo>().First(e => e.Id == Guid.NewGuid() && e.Cardinality == Cardinality.OneToOne && e.AutoCreate == true),
                        Mocks.Of<IElementInfo>().First(e => e.Id == Guid.NewGuid() && e.Cardinality == Cardinality.ZeroToMany)
                    });
                viewInfoMock.Setup(x => x.ExtensionPoints)
                    .Returns(new List<IExtensionPointInfo>
                    {
                        Mocks.Of<IExtensionPointInfo>().First(e => e.Id == Guid.NewGuid() && e.Cardinality == Cardinality.OneToOne && e.AutoCreate == true && e.RequiredExtensionPointId == "ext_1"),
                        Mocks.Of<IExtensionPointInfo>().First(e => e.Id == Guid.NewGuid() && e.Cardinality == Cardinality.ZeroToMany && e.RequiredExtensionPointId == "ext_2"),
                    });

                this.viewInfo = viewInfoMock.Object;

                var providedExtension1 = Mocks.Of<IProvidedExtensionPointInfo>().First(x => x.ExtensionPointId == "ext_1");
                var extensionPoint1 = Mocks.Of<IInstalledToolkitInfo>().First(x =>
                    x.Id == "ext_toolkit_1" &&
                    x.Schema.Pattern.Id == Guid.NewGuid() &&
                    x.Schema.Pattern.ExtensionId == "ext_toolkit_1" &&
                    x.Schema.Pattern.ProvidedExtensionPoints == new[] { providedExtension1 });

                var providedExtension2 = Mocks.Of<IProvidedExtensionPointInfo>().First(x => x.ExtensionPointId == "ext_2");
                var extensionPoint2 = Mocks.Of<IInstalledToolkitInfo>().First(x =>
                    x.Id == "ext_toolkit_2" &&
                    x.Schema.Pattern.Id == Guid.NewGuid() &&
                    x.Schema.Pattern.ExtensionId == "ext_toolkit_2" &&
                    x.Schema.Pattern.ProvidedExtensionPoints == new[] { providedExtension2 });

                var toolkit = Mocks.Of<IInstalledToolkitInfo>().First(x =>
                    x.Id == "test_toolkit" &&
                    x.Schema.Pattern.Id == Guid.NewGuid() &&
                    x.Schema.Pattern.Views == new[] { viewInfo } &&
                    x.Schema.Pattern.ProvidedExtensionPoints == new[] { providedExtension1, providedExtension2 });

                var patternManager = new Mock<IPatternManager>();
                patternManager.Setup(x => x.InstalledToolkits)
                    .Returns(new[] { toolkit, extensionPoint1, extensionPoint2 });

                var serviceProvider = new Mock<IServiceProvider>();
                serviceProvider.Setup(x => x.GetService(typeof(IPatternManager)))
                    .Returns(patternManager.Object);

                using (var store = new Microsoft.VisualStudio.Modeling.Store(serviceProvider.Object, typeof(Microsoft.VisualStudio.Modeling.CoreDomainModel), typeof(ProductStateStoreDomainModel)))
                using (var tx = store.TransactionManager.BeginTransaction())
                {
                    var productStore = store.ElementFactory.CreateElement<ProductState>();

                    var view = productStore
                        .CreateProduct(x => { x.ExtensionId = "test_toolkit"; x.DefinitionId = toolkit.Schema.Pattern.Id; })
                        .CreateView(x => x.DefinitionId = this.viewInfo.Id);

                    this.viewId = view.Id;

                    view.CreateElement(x => x.DefinitionId = this.viewInfo.Elements.ElementAt(2).Id);
                    view.CreateElement(x => x.DefinitionId = this.viewInfo.Elements.ElementAt(2).Id);

                    view.CreateExtension(x => { x.DefinitionId = extensionPoint1.Schema.Pattern.Id; x.ExtensionId = extensionPoint1.Schema.Pattern.ExtensionId; });
                    view.CreateExtension(x => { x.DefinitionId = extensionPoint2.Schema.Pattern.Id; x.ExtensionId = extensionPoint2.Schema.Pattern.ExtensionId; });
                    view.CreateExtension(x => { x.DefinitionId = extensionPoint2.Schema.Pattern.Id; x.ExtensionId = extensionPoint2.Schema.Pattern.ExtensionId; });

                    ProductStateStoreSerializationHelper.Instance.SaveModel(new Microsoft.VisualStudio.Modeling.SerializationResult(), productStore, this.storeFilePath);
                    tx.Commit();
                }

                this.store = new Microsoft.VisualStudio.Modeling.Store(serviceProvider.Object, typeof(Microsoft.VisualStudio.Modeling.CoreDomainModel), typeof(ProductStateStoreDomainModel));
            }
 public RelationshipDialog(nHydrateModel model, Microsoft.VisualStudio.Modeling.Store store, EntityHasEntities connector)
     : this(model, store, connector, false)
 {
 }
Beispiel #45
0
 // Constructors were not generated for this relationship because it had HasCustomConstructor
 // set to true. Please provide the constructors below in a partial class.
 public EntityAssociationConnector(Microsoft.VisualStudio.Modeling.Store store, params Microsoft.VisualStudio.Modeling.PropertyAssignment[] propertyAssignments)
     : this(store != null ? store.DefaultPartitionForClass(DomainClassId) : null, propertyAssignments)
 {
 }
            public void Initialize()
            {
                var serviceProvider = Mocks.Of<IServiceProvider>().First(provider =>
                    provider.GetService(typeof(IPatternManager)) == Mocks.Of<IPatternManager>().First(manager =>
                        manager.InstalledToolkits == new IInstalledToolkitInfo[]
                        {
                            Mocks.Of<IInstalledToolkitInfo>().First(toolkitInfo =>
                                toolkitInfo.Id == Ids.ExtensionToolkitId &&
                                toolkitInfo.Schema.Pattern.Id == Ids.ExtensionProductId &&
                                toolkitInfo.Schema.Pattern.ExtensionId == Ids.ExtensionToolkitId &&
                                toolkitInfo.Schema.Pattern.ProvidedExtensionPoints == new[]
                                {
                                    Mocks.Of<IProvidedExtensionPointInfo>().First(extensionPoint => extensionPoint.ExtensionPointId == "ValidExtensionPointId")
                                }),
                            Mocks.Of<IInstalledToolkitInfo>().First(toolkitInfo =>
                                toolkitInfo.Id == Ids.WebServiceToolkitId &&
                                toolkitInfo.Schema.Pattern.Id == Ids.WebServiceProductId &&
                                toolkitInfo.Schema.Pattern.Name == "Pattern" &&
                                toolkitInfo.Schema.Pattern.ExtensionId == Ids.WebServiceToolkitId &&
                                toolkitInfo.Schema.Pattern.Properties == new []
                                {
                                    Mocks.Of<IPropertyInfo>().First(isSecured =>
                                        isSecured.Name == "IsSecured" &&
                                        isSecured.Type == typeof(bool).FullName &&
                                        isSecured.TypeConverterTypeName == "Toolkit14.TrueConverter"),
                                    Mocks.Of<IPropertyInfo>().First(xmlNamespac =>
                                        xmlNamespac.Name == "XmlNamespace" &&
                                        xmlNamespac.Type == typeof(string).FullName &&
                                        xmlNamespac.DefaultValue.Value == "microsoft.com"),
                                } &&
                                toolkitInfo.Schema.Pattern.Views == new []
                                {
                                    Mocks.Of<IViewInfo>().First(view =>
                                        view.Id == Ids.ArchitectureViewId &&
                                        view.Name == "Architecture" &&
                                        view.Elements == new IAbstractElementInfo[]
                                        {
                                            Mocks.Of<ICollectionInfo>().First(folder =>
                                                folder.Id == Ids.FolderCollectionId &&
                                                folder.Name == "Folder" &&
                                                folder.Cardinality == Cardinality.ZeroToMany &&
                                                folder.Elements == new IAbstractElementInfo[]
                                                {
                                                    Mocks.Of<IElementInfo>().First(dataContract =>
                                                        dataContract.Id == Ids.DataContractElementId &&
                                                        dataContract.Name == "DataContract" &&
                                                        dataContract.Cardinality == Cardinality.ZeroToMany &&
                                                        dataContract.Properties == new []
                                                        {
                                                            Mocks.Of<IPropertyInfo>().First(xsdFile =>
                                                                xsdFile.Id == Guid.NewGuid() &&
                                                                xsdFile.Name == "XsdFile" &&
                                                                xsdFile.Type == typeof(string).FullName
                                                                ),
                                                        } &&
                                                        dataContract.ExtensionPoints == new []
                                                        {
                                                            Mocks.Of<IExtensionPointInfo>().First(extensionPoint =>
                                                                extensionPoint.Id == Guid.NewGuid() &&
                                                                extensionPoint.Name == "Serializer" &&
                                                                extensionPoint.Cardinality == Cardinality.ZeroToMany &&
                                                                extensionPoint.RequiredExtensionPointId == "ValidExtensionPointId"
                                                                ),
                                                        }),
                                                }),
                                        })
                                }),
                        })
                    );

                using (var store = new Microsoft.VisualStudio.Modeling.Store(serviceProvider, typeof(Microsoft.VisualStudio.Modeling.CoreDomainModel), typeof(ProductStateStoreDomainModel)))
                using (var tx = store.TransactionManager.BeginTransaction())
                {
                    var productStore = store.ElementFactory.CreateElement<ProductState>();
                    productStore
                        .CreateProduct(p => { p.ExtensionId = Ids.WebServiceToolkitId; p.DefinitionId = Ids.WebServiceProductId; });
                    //.CreateView(v => v.DefinitionId = Ids.ArchitectureViewId);

                    ProductStateStoreSerializationHelper.Instance.SaveModel(new Microsoft.VisualStudio.Modeling.SerializationResult(), productStore, this.storeFilePath);
                    tx.Commit();
                }

                this.store = new Microsoft.VisualStudio.Modeling.Store(serviceProvider, typeof(Microsoft.VisualStudio.Modeling.CoreDomainModel), typeof(ProductStateStoreDomainModel));
                using (var tx = this.store.TransactionManager.BeginTransaction("Loading", true))
                {
                    ProductStateStoreSerializationHelper.Instance.LoadModel(this.store, this.storeFilePath, null, null, null);
                    tx.Commit();
                }

                this.product = this.store.ElementDirectory.FindElements<Product>().First();
            }
            public void Initialize()
            {
                var serviceProvider = Mocks.Of <IServiceProvider>().First(provider =>
                                                                          provider.GetService(typeof(IPatternManager)) == Mocks.Of <IPatternManager>().First(manager =>
                                                                                                                                                             manager.InstalledToolkits == new IInstalledToolkitInfo[]
                {
                    Mocks.Of <IInstalledToolkitInfo>().First(toolkitInfo =>
                                                             toolkitInfo.Id == Ids.ExtensionToolkit1Id &&
                                                             toolkitInfo.Schema.Pattern.Id == Ids.ExtensionProduct1Id &&
                                                             toolkitInfo.Schema.Pattern.Name == "Product1" &&
                                                             toolkitInfo.Schema.Pattern.ExtensionId == Ids.ExtensionToolkit1Id &&
                                                             toolkitInfo.Schema.Pattern.OrderGroup == 7 &&
                                                             toolkitInfo.Schema.Pattern.ProvidedExtensionPoints == new[]
                    {
                        Mocks.Of <IProvidedExtensionPointInfo>().First(extensionPoint => extensionPoint.ExtensionPointId == "ExtensionPoint1Id")
                    }),
                    Mocks.Of <IInstalledToolkitInfo>().First(toolkitInfo =>
                                                             toolkitInfo.Id == Ids.ExtensionToolkit2Id &&
                                                             toolkitInfo.Schema.Pattern.Id == Ids.ExtensionProduct2Id &&
                                                             toolkitInfo.Schema.Pattern.Name == "Product2" &&
                                                             toolkitInfo.Schema.Pattern.ExtensionId == Ids.ExtensionToolkit2Id &&
                                                             toolkitInfo.Schema.Pattern.OrderGroup == 8 &&
                                                             toolkitInfo.Schema.Pattern.ProvidedExtensionPoints == new[]
                    {
                        Mocks.Of <IProvidedExtensionPointInfo>().First(extensionPoint => extensionPoint.ExtensionPointId == "ExtensionPoint2Id")
                    }),
                    Mocks.Of <IInstalledToolkitInfo>().First(toolkitInfo =>
                                                             toolkitInfo.Id == Ids.MainToolkitId &&
                                                             toolkitInfo.Schema.Pattern.Id == Ids.MainProductId &&
                                                             toolkitInfo.Schema.Pattern.Name == "MainProduct" &&
                                                             toolkitInfo.Schema.Pattern.ExtensionId == Ids.MainToolkitId &&
                                                             toolkitInfo.Schema.Pattern.Views == new []
                    {
                        //MainProduct
                        //  View
                        //      MainElement
                        //          Collection1
                        //              Property1
                        //          Collection2
                        //          Element1
                        //          Element2
                        //          Element3
                        //          ExtensionPoint1
                        //          ExtensionPoint2
                        Mocks.Of <IViewInfo>().First(view =>
                                                     view.Id == Ids.MainViewId &&
                                                     view.Name == "View" &&
                                                     view.Elements == new IAbstractElementInfo[]
                        {
                            Mocks.Of <IElementInfo>().First(element =>
                                                            element.Id == Ids.MainElementId &&
                                                            element.Name == "MainElement" &&
                                                            element.Cardinality == Cardinality.ZeroToMany &&
                                                            element.Elements == new IAbstractElementInfo[]
                            {
                                Mocks.Of <ICollectionInfo>().First(ce =>
                                                                   ce.Id == Ids.Collection1Id &&
                                                                   ce.Name == "Collection1" &&
                                                                   ce.OrderGroup == 1 &&
                                                                   ce.Cardinality == Cardinality.ZeroToMany &&
                                                                   ce.Properties == new [] { Mocks.Of <IPropertyInfo>().First(p =>
                                                                                                                              p.Name == "Property1" &&
                                                                                                                              p.Id == Ids.Property1Id &&
                                                                                                                              p.Type == typeof(string).FullName) }
                                                                   ),
                                Mocks.Of <ICollectionInfo>().First(ce =>
                                                                   ce.Id == Ids.Collection2Id &&
                                                                   ce.Name == "Collection2" &&
                                                                   ce.OrderGroup == 1 &&
                                                                   ce.Cardinality == Cardinality.ZeroToMany
                                                                   ),
                                Mocks.Of <IElementInfo>().First(ce =>
                                                                ce.Id == Ids.Element1Id &&
                                                                ce.Name == "Element1" &&
                                                                ce.OrderGroup == 2 &&
                                                                ce.Cardinality == Cardinality.ZeroToMany
                                                                ),
                                Mocks.Of <IElementInfo>().First(ce =>
                                                                ce.Id == Ids.Element2Id &&
                                                                ce.Name == "Element2" &&
                                                                ce.OrderGroup == 3 &&
                                                                ce.Cardinality == Cardinality.ZeroToMany
                                                                ),
                            } &&
                                                            element.ExtensionPoints == new IExtensionPointInfo[]
                            {
                                Mocks.Of <IExtensionPointInfo>().First(extensionPoint =>
                                                                       extensionPoint.Id == Ids.ExtensionPoint1Id &&
                                                                       extensionPoint.Name == "ExtensionPoint1" &&
                                                                       extensionPoint.OrderGroup == 4 &&
                                                                       extensionPoint.Cardinality == Cardinality.ZeroToMany &&
                                                                       extensionPoint.RequiredExtensionPointId == "ExtensionPoint1Id"
                                                                       ),
                                Mocks.Of <IExtensionPointInfo>().First(extensionPoint =>
                                                                       extensionPoint.Id == Ids.ExtensionPoint2Id &&
                                                                       extensionPoint.Name == "ExtensionPoint2" &&
                                                                       extensionPoint.OrderGroup == 5 &&
                                                                       extensionPoint.Cardinality == Cardinality.ZeroToMany &&
                                                                       extensionPoint.RequiredExtensionPointId == "ExtensionPoint2Id"
                                                                       ),
                            }),
                        }),
                    }),
                })
                                                                          );

                using (var store = new Microsoft.VisualStudio.Modeling.Store(serviceProvider, typeof(Microsoft.VisualStudio.Modeling.CoreDomainModel), typeof(ProductStateStoreDomainModel)))
                    using (var tx = store.TransactionManager.BeginTransaction())
                    {
                        var productStore = store.ElementFactory.CreateElement <ProductState>();
                        productStore
                        .CreateProduct(p => { p.ExtensionId = Ids.MainToolkitId; p.DefinitionId = Ids.MainProductId; })
                        .CreateView(v => v.DefinitionId    = Ids.MainViewId)
                        .CreateElement(e => e.DefinitionId = Ids.MainElementId);

                        ProductStateStoreSerializationHelper.Instance.SaveModel(new Microsoft.VisualStudio.Modeling.SerializationResult(), productStore, this.storeFilePath);
                        tx.Commit();
                    }

                this.store = new Microsoft.VisualStudio.Modeling.Store(serviceProvider, typeof(Microsoft.VisualStudio.Modeling.CoreDomainModel), typeof(ProductStateStoreDomainModel));
                using (var tx = this.store.TransactionManager.BeginTransaction("Loading", true))
                {
                    ProductStateStoreSerializationHelper.Instance.LoadModel(this.store, this.storeFilePath, null, null, null);
                    tx.Commit();

                    this.productStore = this.store.ElementDirectory.AllElements.OfType <ProductState>().First();
                }

                this.mainElement = this.store.ElementDirectory.FindElements <Element>(true).First();
                this.view        = this.store.ElementDirectory.FindElements <View>(true).First();
            }
 void ORMSolutions.ORMArchitect.Framework.Shell.IDomainModelEnablesRulesAfterDeserialization.EnableRulesAfterDeserialization(Microsoft.VisualStudio.Modeling.Store store)
 {
     this.EnableRulesAfterDeserialization(store);
 }
            public void Initialize()
            {
                this.storeFilePath = Path.Combine(Path.GetTempPath(), Path.GetTempFileName());

                var toolkit = Mocks.Of<IInstalledToolkitInfo>().First(
                    x => x.Id == "test_toolkit" && x.Schema.Pattern.Id == Guid.NewGuid());
                this.productInfo = toolkit.Schema.Pattern;

                var productMock = Mock.Get(this.productInfo);
                productMock.Setup(x => x.Views)
                    .Returns(Mocks.Of<IViewInfo>(x => x.Id == Guid.NewGuid() && x.Pattern == this.productInfo).Take(2).ToList());
                productMock.Setup(x => x.Properties)
                    .Returns(Mocks.Of<IPropertyInfo>(x =>
                        x.Id == Guid.NewGuid() &&
                        x.Name == "Foo" + Guid.NewGuid() &&
                        x.Type == "System.String" &&
                        x.Parent == this.productInfo).Take(2).ToList());

                var serviceProvider = new Mock<IServiceProvider>();
                serviceProvider.Setup(x => x.GetService(typeof(IPatternManager)))
                    .Returns(Mocks.Of<IPatternManager>().First(x => x.InstalledToolkits == new[] { toolkit }));

                using (var store = new Microsoft.VisualStudio.Modeling.Store(serviceProvider.Object, typeof(Microsoft.VisualStudio.Modeling.CoreDomainModel), typeof(ProductStateStoreDomainModel)))
                using (var tx = store.TransactionManager.BeginTransaction())
                {
                    var productStore = store.ElementFactory.CreateElement<ProductState>();

                    var product = productStore
                        .CreateProduct(x => { x.ExtensionId = "test_toolkit"; x.DefinitionId = toolkit.Schema.Pattern.Id; });

                    this.productId = product.Id;

                    ProductStateStoreSerializationHelper.Instance.SaveModel(new Microsoft.VisualStudio.Modeling.SerializationResult(), productStore, this.storeFilePath);
                    tx.Commit();
                }

                this.store = new Microsoft.VisualStudio.Modeling.Store(serviceProvider.Object, typeof(Microsoft.VisualStudio.Modeling.CoreDomainModel), typeof(ProductStateStoreDomainModel));
            }
            public void InitializeContext()
            {
                var serviceProvider = Mocks.Of<IServiceProvider>().First(provider =>
                                        provider.GetService(typeof(IPatternManager)) == Mocks.Of<IPatternManager>().First(manager =>
                                            manager.InstalledToolkits == new IInstalledToolkitInfo[]
                        {
                            Mocks.Of<IInstalledToolkitInfo>().First(toolkitInfo =>
                                toolkitInfo.Id == Ids.PatternToolkit1Id &&
                                toolkitInfo.Schema.Pattern.Id == Ids.ExtensionToolkitPatternSchema1Id &&
                                toolkitInfo.Schema.Pattern.ExtensionId == Ids.PatternToolkit1Id &&
                                toolkitInfo.Schema.Pattern.ProvidedExtensionPoints == new[]
                                {
                                    Mocks.Of<IProvidedExtensionPointInfo>().First(extensionPoint => extensionPoint.ExtensionPointId == Ids.ExtensionPointSchemaPath1),
                                    Mocks.Of<IProvidedExtensionPointInfo>().First(extensionPoint => extensionPoint.ExtensionPointId == Ids.ExtensionPointSchemaPath2)
                                }),
                            Mocks.Of<IInstalledToolkitInfo>().First(toolkitInfo =>
                                toolkitInfo.Id == Ids.PatternToolkit2Id &&
                                toolkitInfo.Schema.Pattern.Id == Ids.ExtensionToolkitPatternSchema2Id &&
                                toolkitInfo.Schema.Pattern.ExtensionId == Ids.PatternToolkit2Id &&
                                toolkitInfo.Schema.Pattern.ProvidedExtensionPoints == new[]
                                {
                                    Mocks.Of<IProvidedExtensionPointInfo>().First(extensionPoint => extensionPoint.ExtensionPointId == Ids.ExtensionPointSchemaPath2)
                                }),
                            Mocks.Of<IInstalledToolkitInfo>().First(toolkitInfo =>
                                toolkitInfo.Id == Ids.SecondToolkitId &&
                                toolkitInfo.Schema.Pattern.Id == Ids.SecondPatternSchemaId &&
                                toolkitInfo.Schema.Pattern.Name == "SecondPatternSchema" &&
                                toolkitInfo.Schema.Pattern.ExtensionId == Ids.MainToolkitId),
                            Mocks.Of<IInstalledToolkitInfo>().First(toolkitInfo =>
                                toolkitInfo.Id == Ids.MainToolkitId &&
                                toolkitInfo.Schema.Pattern.Id == Ids.MainPatternSchemaId &&
                                toolkitInfo.Schema.Pattern.Name == "MainPatternSchema" &&
                                toolkitInfo.Schema.Pattern.ExtensionId == Ids.MainToolkitId &&
                                toolkitInfo.Schema.Pattern.Views == new []
                                {
                                    //  View
                                    //          ExtensionPoint1
                                    //          ExtensionPoint2
                                    Mocks.Of<IViewInfo>().First(view =>
                                        view.Id == Ids.MainViewSchemaId &&
                                        view.Name == "View" &&
                                        view.ExtensionPoints == new IExtensionPointInfo[]
                                        {
                                            Mocks.Of<IExtensionPointInfo>().First(extensionPoint =>
                                                extensionPoint.Id == Ids.ExtensionPointSchema1Id &&
                                                extensionPoint.Name == "ExtensionPointSchema1" &&
                                                extensionPoint.OrderGroup == 2 &&
                                                extensionPoint.Cardinality == Cardinality.ZeroToMany &&
                                                extensionPoint.RequiredExtensionPointId == Ids.ExtensionPointSchemaPath1
                                                ),
                                            Mocks.Of<IExtensionPointInfo>().First(extensionPoint =>
                                                extensionPoint.Id == Ids.ExtensionPointSchema2Id &&
                                                extensionPoint.Name == "ExtensionPointSchema2" &&
                                                extensionPoint.OrderGroup == 3 &&
                                                extensionPoint.Cardinality == Cardinality.ZeroToOne &&
                                                extensionPoint.RequiredExtensionPointId == Ids.ExtensionPointSchemaPath2
                                                ),
                                        }),
                                }),
                        })
                    );

                using (var store = new Microsoft.VisualStudio.Modeling.Store(serviceProvider, typeof(Microsoft.VisualStudio.Modeling.CoreDomainModel), typeof(ProductStateStoreDomainModel)))
                using (var tx = store.TransactionManager.BeginTransaction())
                {
                    var productStore = store.ElementFactory.CreateElement<ProductState>();
                    productStore
                        .CreateProduct(p => { p.ExtensionId = Ids.SecondToolkitId; p.DefinitionId = Ids.SecondPatternSchemaId; });
                    productStore
                        .CreateProduct(p => { p.ExtensionId = Ids.SecondToolkitId; p.DefinitionId = Ids.SecondPatternSchemaId; });
                    productStore
                        .CreateProduct(p => { p.ExtensionId = Ids.MainToolkitId; p.DefinitionId = Ids.MainPatternSchemaId; })
                        .CreateView(v => v.DefinitionId = Ids.MainViewSchemaId);

                    ProductStateStoreSerializationHelper.Instance.SaveModel(new Microsoft.VisualStudio.Modeling.SerializationResult(), productStore, this.storeFilePath);
                    tx.Commit();
                }

                this.store = new Microsoft.VisualStudio.Modeling.Store(serviceProvider, typeof(Microsoft.VisualStudio.Modeling.CoreDomainModel), typeof(ProductStateStoreDomainModel));
                using (var tx = this.store.TransactionManager.BeginTransaction("Loading", true))
                {
                    ProductStateStoreSerializationHelper.Instance.LoadModel(this.store, this.storeFilePath, null, null, null);
                    tx.Commit();

                    this.productStore = this.store.ElementDirectory.AllElements.OfType<ProductState>().First();
                }

                this.rootProduct3 = this.store.ElementDirectory.FindElements<Product>(true).Where(p => p.DefinitionId == Ids.SecondPatternSchemaId).ToArray()[0];
                this.rootProduct2 = this.store.ElementDirectory.FindElements<Product>(true).Where(p => p.DefinitionId == Ids.SecondPatternSchemaId).ToArray()[1];
                this.rootProduct1 = this.store.ElementDirectory.FindElements<Product>(true).First(p => p.DefinitionId == Ids.MainPatternSchemaId);
                this.view = rootProduct1.Views.First();

                this.extensionPointInfo2 = this.view.Info.ExtensionPoints.First(ep => ep.Id == Ids.ExtensionPointSchema2Id);

                this.extensionProduct1 = this.view.CreateExtension(prod => { prod.ProductState = this.productStore; prod.ExtensionId = Ids.PatternToolkit1Id; prod.DefinitionId = Ids.ExtensionToolkitPatternSchema1Id; });
                this.extensionProduct2 = this.view.CreateExtension(prod => { prod.ProductState = this.productStore; prod.ExtensionId = Ids.PatternToolkit1Id; prod.DefinitionId = Ids.ExtensionToolkitPatternSchema1Id; });
                this.extensionProduct4 = this.view.CreateExtension(prod => { prod.ProductState = this.productStore; prod.ExtensionId = Ids.PatternToolkit2Id; prod.DefinitionId = Ids.ExtensionToolkitPatternSchema2Id; });
            }
Beispiel #51
0
		public DeleteColumnsForm(nHydrateModel model, Microsoft.VisualStudio.Modeling.Store store)
			: this()
		{
			_model = model;
			_store = store;
		}
Beispiel #52
0
        public ImportDatabaseForm(
            nHydrateModel model,
            Microsoft.VisualStudio.Modeling.Store store,
            Microsoft.VisualStudio.Modeling.Diagrams.Diagram diagram,
            nHydrate.DataImport.Database currentDatabase,
            Microsoft.VisualStudio.Modeling.Shell.ModelingDocData docData)
            : this()
        {
            _model = model;
            _store = store;
            _diagram = diagram;
            _docData = docData;
            this.CurrentDatabase = currentDatabase;

            this.DatabaseConnectionControl1.FileName = Path.Combine((new FileInfo(docData.FileName)).DirectoryName, "importconnection.cache");

            tvwAdd.AfterCheck += new TreeViewEventHandler(treeView1_AfterCheck);
            tvwRefresh.AfterCheck += new TreeViewEventHandler(treeView1_AfterCheck);
            tvwDelete.AfterCheck += new TreeViewEventHandler(treeView1_AfterCheck);

            //tvwAdd.AfterSelect += new TreeViewEventHandler(treeView1_AfterSelect);
            //tvwRefresh.AfterSelect += new TreeViewEventHandler(treeView1_AfterSelect);
            //tvwDelete.AfterSelect += new TreeViewEventHandler(treeView1_AfterSelect);

            wizard1.BeforeSwitchPages += new nHydrate.Wizard.Wizard.BeforeSwitchPagesEventHandler(wizard1_BeforeSwitchPages);
            wizard1.AfterSwitchPages += new nHydrate.Wizard.Wizard.AfterSwitchPagesEventHandler(wizard1_AfterSwitchPages);
            wizard1.Finish += new EventHandler(wizard1_Finish);
            wizard1.FinishEnabled = false;
            chkSettingPK.CheckedChanged += new EventHandler(chkSettingPK_CheckedChanged);
            cmdTestConnection.Click += new EventHandler(cmdTestConnection_Click);

            this.Settings = new ImportModelSettings();
            this.Settings.OverridePrimaryKey = chkSettingPK.Checked;

            DatabaseConnectionControl1.LoadSettings();

            cboModule.Items.Add("(Choose One)");
            model.Modules.ForEach(x => cboModule.Items.Add(x.Name));
            cboModule.SelectedIndex = 0;
            cboModule.Enabled = model.UseModules;
            chkMergeModule.Visible = model.UseModules;

            EnableButtons();
        }