示例#1
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {

                Method method = new Method();
                method.Name = tbMethodName.Text;
                method.Comment = tbMethodComment.Text;
                method.AccessModifier = (AccessModifier)cbMethodAccessModifier.SelectedValue;
                method.Class = cls;

                if (rbTyped.Checked)
                {
                    ReturnType rt = new ReturnType();
                    rt.Class = (Class)cbMethodType.SelectedValue;
                    method.ReturnType = rt;
                    context.ReturnTypeSet.AddObject(rt);
                }

                byte order = 0;
                foreach (Parameter p in listParams)
                {
                    p.OrderNmber = order++;
                    method.Parameters.Add(p);
                }

                context.MethodSet.AddObject(method);
                context.SaveChanges();

                this.DialogResult = DialogResult.OK;

            }
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the ReturnTypeSet EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToReturnTypeSet(ReturnType returnType)
 {
     base.AddObject("ReturnTypeSet", returnType);
 }
 /// <summary>
 /// Create a new ReturnType object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="classId">Initial value of the ClassId property.</param>
 public static ReturnType CreateReturnType(global::System.Int32 id, global::System.Int32 classId)
 {
     ReturnType returnType = new ReturnType();
     returnType.Id = id;
     returnType.ClassId = classId;
     return returnType;
 }