Example #1
0
 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);
     }
 }
Example #2
0
        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);
            }
        }
Example #3
0
        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);
            }
        }
Example #4
0
        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);
            }
        }
Example #5
0
        /// <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);
        }