private void btnInsert_Click(object sender, EventArgs e) { MDataRow row = MDataRow.CreateFrom(new UsersBean()); row.LoadFrom(false, this); DBFast.Insert <UsersBean>(row.ToEntity <UsersBean>(), InsertOp.ID, chbInsertID.Checked); LoadData(); OutMsg(); }
private void btnUpdate_Click(object sender, EventArgs e) { MDataRow row = MDataRow.CreateFrom(new UsersBean()); row.LoadFrom(false, this); DBFast.Update <UsersBean>(row.ToEntity <UsersBean>()); LoadData(); OutMsg(); }
/// <summary> /// 查找单条记录 /// </summary> /// <typeparam name="T">实体类型</typeparam> /// <param name="where">条件</param> /// <param name="columns">指定查询的列(可选)</param> /// <returns></returns> public static T Find <T>(object where, params string[] columns) { T result = default(T); MDataRow row = null; using (MAction action = GetMAction <T>()) { if (columns != null && columns.Length > 0) { action.SetSelectColumns(columns); } if (action.Fill(where)) { row = action.Data; } } if (row != null) { result = row.ToEntity <T>(); } return(result); }
private void BtnToEntity_Click(object sender, EventArgs e) { Entity et = row.ToEntity <Entity>(); rtxtText.Text = "ToEntity:" + GetText(et);; }