Ejemplo n.º 1
0
        public async Task <ActionResult <string> > FKInsertPerf()
        {
            var q = new Store.TableScan(Consts.SYS_EMPLOEE_MODEL_ID);

            q.Filter(q.GetString(Consts.EMPLOEE_NAME_ID) == "Admin");
            var emps = await q.ToListAsync();

            var model = await RuntimeContext.Current.GetModelAsync <EntityModel>(Consts.SYS_ORGUNIT_MODEL_ID);

            return(await SimplePerfTest.Run(64, 1000, async (i, j) =>
            {
                var ou = new Entity(model);
                ou.SetString(1 << IdUtil.MEMBERID_SEQ_OFFSET, "OUName");
                ou.SetEntityId(2 << IdUtil.MEMBERID_SEQ_OFFSET, emps[0].Id);
                var txn = await Store.Transaction.BeginAsync();
                try
                {
                    await Store.EntityStore.InsertEntityAsync(ou, txn);
                    await txn.CommitAsync();
                }
                catch (Exception ex)
                {
                    txn.Rollback();
                    Console.WriteLine($"Insert orgunit error: {ex.Message}");
                }
            }));
        }
Ejemplo n.º 2
0
        public async Task <string> LoadEntitySetPerf()
        {
            var q = new Store.TableScan(Consts.SYS_ORGUNIT_MODEL_ID);

            q.Filter(q.GetString(Consts.ORGUNIT_NAME_ID) == "IT Dept");
            var parent = await q.ToListAsync();

            var parentId = parent[0].Id;

            return(await SimplePerfTest.Run(32, 4000, async (i, j) =>
            {
                await Store.EntityStore.LoadEntitySetAsync(Consts.SYS_ORGUNIT_MODEL_ID, parentId, Consts.ORGUNIT_CHILDS_ID);
            }));
        }
Ejemplo n.º 3
0
        public async Task <ActionResult <string> > ScanPerf(int tasks, int loop)
        {
            if (tasks <= 0 || loop <= 0)
            {
                throw new ArgumentOutOfRangeException();
            }

            return(await SimplePerfTest.Run(tasks, loop, async (i, j) =>
            {
                var q = new Store.TableScan(Consts.SYS_EMPLOEE_MODEL_ID);
                q.Filter(q.GetString(Consts.EMPLOEE_NAME_ID) == "Admin");
                await q.ToListAsync();
            }));
        }
Ejemplo n.º 4
0
        public async Task <object> LoadEntitySet()
        {
            var q = new Store.TableScan(Consts.SYS_ORGUNIT_MODEL_ID);

            q.Filter(q.GetString(Consts.ORGUNIT_NAME_ID) == "IT Dept");
            var parent = await q.ToListAsync();

            var parentId = parent[0].Id;

            var list = await Store.EntityStore.LoadEntitySetAsync(Consts.SYS_ORGUNIT_MODEL_ID, parentId, Consts.ORGUNIT_CHILDS_ID);

            if (list == null)
            {
                return("Null");
            }
            return(list.Select(t => t.GetString(Consts.ORGUNIT_NAME_ID)).ToArray());
        }
Ejemplo n.º 5
0
        public async Task <ActionResult <string> > Scan()
        {
            var q = new Store.TableScan(Consts.SYS_EMPLOEE_MODEL_ID);

            q.Filter(q.GetString(Consts.EMPLOEE_NAME_ID) == "Admin");
            var res = await q.ToListAsync();

            Guid   id    = Guid.Empty;
            string name  = string.Empty;
            int    count = 0;

            if (res != null && res.Count > 0)
            {
                count = res.Count;
                id    = res[0].Id;
                name  = res[0].GetString(Consts.EMPLOEE_NAME_ID);
            }
            return($"TableScan done. Rows={count} Id[0]={id} Name[0]={name}\n");
        }