public async Task Insert() { await using var dbContex = new MySqlDbContext(true); for (int i = 0; i < Count; i++) { var a = new UserEntrity(); a.Age = 12; a.CreateTime = 12; await dbContex.Datas.InsertAsync <UserEntrity>(a); } }
public async Task InsertEf() { using var context = new MysqlContent(); for (int i = 0; i < Count; i++) { var a = new UserEntrity(); context.UserEntrities.Add(a); await context.SaveChangesAsync(); // context.UserEntrities.FirstOrDefault(t => t.Id == a.Id); } }
public void TestGetProperty1() { var obj = new UserEntrity() { Age = 1, Name = "a", }; var fun = ReflectorUtil.Instance.GetPropertyValueFun <UserEntrity>("Age"); for (int i = 0; i < Count; i++) { var value = fun.Invoke(obj); } }
public void TestGetProperty3() { var obj = new UserEntrity() { Age = 1, Name = "a", }; var type = obj.GetType(); var property = type.GetProperty("Age"); for (int i = 0; i < Count; i++) { var value = property.GetValue(obj, null); } }
/// <summary> /// Inserts the and get. /// </summary> /// <param name="userEntrity">The user entrity.</param> /// <returns>A ValueTask.</returns> public async ValueTask <UserEntrity> InsertAndGet(UserEntrity userEntrity) { var r = await repository.InsertAndGetAsync(userEntrity); return(r); }