private void btnOk_Click(object sender, EventArgs e) { if (ValidateForm()) { MemberType mt = new MemberType(); mt.Class = (Class)cbMemberType.SelectedValue; context.MemberTypeSet.AddObject(mt); Member m = new Member(); m.Name = tbClassMemberName.Text; m.AccessModifier = (AccessModifier)cbMemberAccessModifier.SelectedValue; m.MemberType = mt; m.Class = cls; context.MemberSet.AddObject(m); context.SaveChanges(); this.DialogResult = DialogResult.OK; } }
/// <summary> /// Create a new MemberType object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="classId">Initial value of the ClassId property.</param> public static MemberType CreateMemberType(global::System.Int32 id, global::System.Int32 classId) { MemberType memberType = new MemberType(); memberType.Id = id; memberType.ClassId = classId; return memberType; }
/// <summary> /// Deprecated Method for adding a new object to the MemberTypeSet EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToMemberTypeSet(MemberType memberType) { base.AddObject("MemberTypeSet", memberType); }