private void btnSetToEntity_Click(object sender, EventArgs e) { Entity et = new Entity(); row.SetToEntity(et); rtxtText.Text = "SetoToEntity:" + GetText(et); }
private void btnUpdate_Click(object sender, EventArgs e) { using (UsersBean ub = new UsersBean()) { MDataRow row = MDataRow.CreateFrom(ub); row.LoadFrom(false, this); row.SetToEntity(ub); ub.Update(); } LoadData(); OutMsg(); }
private void btnInsert_Click(object sender, EventArgs e) { using (UsersBean ub = new UsersBean()) { MDataRow row = MDataRow.CreateFrom(ub); row.LoadFrom(false, this); row.SetToEntity(ub); if (ub.Insert(InsertOp.ID, chbInsertID.Checked)) { row.SetToAll(this); } } LoadData(); OutMsg(); }
/// <summary> /// 添加一条记录 /// </summary> /// <typeparam name="T">实体类型</typeparam> /// <param name="t">实体对象</param> /// <returns></returns> public static bool Insert <T>(T t, InsertOp op, bool insertID) { bool result = false; MDataRow row = null; using (MAction action = GetMAction <T>()) { action.AllowInsertID = insertID; action.Data.LoadFrom(t, BreakOp.Null); result = action.Insert(op); if (result && op != InsertOp.None) { row = action.Data; } } if (row != null) { row.SetToEntity(t); } return(result); }