コード例 #1
0
ファイル: PreflightResourceReader.cs プロジェクト: umcu/leaf
        public async Task <PreflightResources> GetResourcesByIdsAsync(ResourceRefs refs)
        {
            using (var cn = new SqlConnection(opts.ConnectionString))
            {
                await cn.OpenAsync();

                var qids = refs.Queries.Select(q => q.Id.Value);
                var cids = refs.Concepts.Select(c => c.Id.Value);
                var iids = refs.Imports.Select(i => i.Id.Value);
                var grid = await cn.QueryMultipleAsync(
                    ResourcePreflightSql.byIds,
                    new {
                    qids        = ResourceIdTable.From(qids),
                    cids        = ResourceIdTable.From(cids),
                    iids        = ResourceIdTable.From(iids),
                    user        = user.UUID,
                    groups      = GroupMembership.From(user),
                    sessionType = user.SessionType,
                    admin       = user.IsAdmin
                },
                    commandTimeout : opts.DefaultTimeout,
                    commandType : CommandType.StoredProcedure
                    );

                return(PreflightReader.ReadResourcesById(grid, refs));
            }
        }
コード例 #2
0
        public async Task <PreflightResources> GetResourcesByUniversalIdsAsync(ResourceRefs refs)
        {
            using (var cn = new SqlConnection(opts.ConnectionString))
            {
                await cn.OpenAsync();

                var quids = refs.Queries.Select(q => q.UniversalId.ToString()).ToHashSet();
                var cuids = refs.Concepts.Select(q => q.UniversalId.ToString()).ToHashSet();
                var grid  = await cn.QueryMultipleAsync(
                    ResourcePreflightSql.byUIds,
                    new {
                    quids       = ResourceUniversalIdTable.From(quids),
                    cuids       = ResourceUniversalIdTable.From(cuids),
                    user        = user.UUID,
                    groups      = GroupMembership.From(user),
                    sessionType = user.SessionType,
                    admin       = user.IsAdmin
                },
                    commandTimeout : opts.DefaultTimeout,
                    commandType : CommandType.StoredProcedure
                    );

                return(PreflightReader.ReadResourcesByUId(grid, refs.Queries));
            }
        }
コード例 #3
0
        public async Task <PreflightConcepts> GetConceptsByIdAsync(Guid conceptId)
        {
            using (var cn = new SqlConnection(opts.ConnectionString))
            {
                await cn.OpenAsync();

                var grid = await cn.QueryMultipleAsync(
                    ConceptPreflightSql.singleId,
                    new { id = conceptId, user = user.UUID, groups = GroupMembership.From(user), admin = user.IsAdmin },
                    commandTimeout : opts.DefaultTimeout,
                    commandType : CommandType.StoredProcedure
                    );

                return(PreflightReader.ReadConcepts(grid));
            }
        }
コード例 #4
0
        public async Task <PreflightConcepts> GetConceptsByUniversalIdsAsync(HashSet <string> conceptUids)
        {
            using (var cn = new SqlConnection(opts.ConnectionString))
            {
                await cn.OpenAsync();

                var grid = await cn.QueryMultipleAsync(
                    ConceptPreflightSql.manyUIds,
                    new { uids = ResourceUniversalIdTable.From(conceptUids), user = user.UUID, groups = GroupMembership.From(user), admin = user.IsAdmin },
                    commandTimeout : opts.DefaultTimeout,
                    commandType : CommandType.StoredProcedure
                    );

                return(PreflightReader.ReadConcepts(grid));
            }
        }