コード例 #1
0
ファイル: IntClassWiz2.cs プロジェクト: mirkomaty/NDO
        public override void OnLeaveView()
        {
            IntermediateClassInfo classInfo = model[model.Index];

            if (this.radioIList.Checked)
            {
                classInfo.CodingStyle = CodingStyle.IList;
            }
            else if (this.radioArrayList.Checked)
            {
                classInfo.CodingStyle = CodingStyle.ArrayList;
            }
            else if (this.radioNDOArrayList.Checked)
            {
                classInfo.CodingStyle = CodingStyle.NDOArrayList;
            }

            RelationDirection dir;

            if (radioToMe.Checked)
            {
                dir = RelationDirection.DirectedFromMe;                // View from the intermediate class
            }
            else
            {
                dir = RelationDirection.Bidirectional;
            }
            classInfo.RelationDirection = dir;
        }
コード例 #2
0
        private void cbRelatedTable2_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            IntermediateClassInfo classInfo = model[1];

            string name = FindTable(cbRelatedTable2.Text).Table.ClassName;

            name = name.Substring(0, 1).ToLower() + name.Substring(1);
            this.txtFieldName2.Text = name;
            classInfo.OwnFieldName  = name;
        }
コード例 #3
0
        public override void OnLeaveView()
        {
            IntermediateClassInfo ici1 = model[0];
            IntermediateClassInfo ici2 = model[1];

            ici1.Table = cbRelatedTable1.Text;
            ici2.Table = cbRelatedTable2.Text;
            ici1.Type  = FindTable(ici1.Table).Table.ClassName;
            ici2.Type  = FindTable(ici2.Table).Table.ClassName;
            ici1.ForeignKeyColumnName = cbForeignKey1.Text;
            ici2.ForeignKeyColumnName = cbForeignKey2.Text;
        }
コード例 #4
0
ファイル: IntClassWiz2.cs プロジェクト: mirkomaty/NDO
        private void IntClassWiz2_Load(object sender, System.EventArgs e)
        {
            IntermediateClassInfo classInfo = model[model.Index];

            RelationDirection dir = classInfo.RelationDirection;

            this.lblBi.Text   = model.TableNode.Text + "<->" + classInfo.Table;
            this.lblToMe.Text = model.TableNode.Text + "->" + classInfo.Table;
            if (dir == RelationDirection.DirectedToMe)
            {
                radioToMe.Checked = true;
            }
            else
            {
                radioBi.Checked = true;
            }

            this.lblClass.Text = classInfo.Type;
            if (classInfo.ForeignFieldName == string.Empty)
            {
                string name = model.TableNode.Text.Replace(" ", string.Empty);
                name = name.Substring(0, 1).ToLower() + name.Substring(1);
                classInfo.ForeignFieldName = name;
            }
            this.txtFieldName.DataBindings.Add("Text", classInfo, "ForeignFieldName");

            if (classInfo.CodingStyle == CodingStyle.IList)
            {
                this.radioIList.Checked = true;
            }
            else if (classInfo.CodingStyle == CodingStyle.ArrayList)
            {
                this.radioArrayList.Checked = true;
            }
            else if (classInfo.CodingStyle == CodingStyle.NDOArrayList)
            {
                this.radioNDOArrayList.Checked = true;
            }
#if !NDO11
            radioArrayList.Text       = "List<T>";
            radioIList.Text           = "IList<T>";
            radioNDOArrayList.Visible = false;
#endif

            Frame.Description = "The relation is visible in class '" + classInfo.Type + "', if Relation Direction is bidirectional.\n\nIf this is the case, enter the name of the field, which will contain the relation, and the relation coding style.";
        }
コード例 #5
0
        public bool MapIntermediateClass(TableNode tn)
        {
//			IntermediateClass ic = new IntermediateClass();
//			IntermediateClassNode icn = new IntermediateClassNode(ic, tn);

            IList tableNodes = new ArrayList();

            foreach (TableNode tnode in databaseNode.TableNodes)
            {
                if (tn.Text == tnode.Text)
                {
                    continue;
                }
                if (tnode.Table.MappingType == TableMappingType.MappedAsClass)
                {
                    tableNodes.Add(tnode);
                }
            }

            IntermediateClassWizardModel model = new IntermediateClassWizardModel(tn, tableNodes);

            IWizardController controller = ApplicationController.wizardControllerFactory.Create
                                               ("IntermediateClassWizController", "IntClassWiz", "Intermediate Class Wizard");

            //controller.FrameSize = new Size(544, 500);
            model[0].RelationDirection = RelationDirection.Bidirectional;
            model[1].RelationDirection = RelationDirection.Bidirectional;
            DialogResult r = controller.Run(model);

            if (r == DialogResult.OK)
            {
                DatabaseNode parent = (DatabaseNode)tn.Parent;
                // Nothing to remove, because we use the original table node
                //				tn.Remove();
                //				tn.Parent.Nodes.Add(icn);
                for (int i = 0; i < 2; i++)
                {
                    ColumnNode            columnNode   = (ColumnNode)tn.FindNode(model[i].ForeignKeyColumnName, typeof(ColumnNode));
                    FkRelation            fkr          = new FkRelation(columnNode.Text);
                    IntermediateClassInfo intermClInfo = model[i];
                    fkr.FieldName          = intermClInfo.OwnFieldName;
                    fkr.ForeignCodingStyle = intermClInfo.CodingStyle;
                    fkr.ForeignFieldName   = intermClInfo.ForeignFieldName;
                    fkr.ForeignIsComposite = false;
                    fkr.IsComposite        = false;
                    fkr.OwningTable        = tn.Text;
                    fkr.OwningType         = tn.Table.ClassName;
                    fkr.RelatedTable       = intermClInfo.Table;
                    fkr.RelatedType        = intermClInfo.Type;
                    fkr.RelationDirection  = intermClInfo.RelationDirection;
                    fkr.RelationName       = string.Empty;
                    //ForeignFkRelation ffkr = fkr.ForeignRelation;
                    RelationNode relationNode = new RelationNode(fkr, tn);
                    relationNode.RelatedTableNode = (TableNode)databaseNode.FindNode(intermClInfo.Table);
                    ForeignKeyWizModel fkwizModel = new ForeignKeyWizModel(relationNode, new ArrayList());

                    tn.DualKeyRelations[i] = intermClInfo.OwnFieldName;

                    MakeForeignKeyRelation(relationNode, columnNode, fkwizModel);
                }
                return(true);
            }
            return(false);
        }