示例#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);
     }
 }
示例#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);
            }
        }
示例#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);
            }
        }
示例#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);
            }
        }
示例#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);
        }