コード例 #1
0
        public Role Handle(RoleByName query)
        {
            if (query == null)
            {
                throw new ArgumentNullException("query");
            }

            var internalQuery = new RolesUnfiltered(query.Principal)
            {
                EagerLoad = query.EagerLoad,
            };

            var internalQueryable = _queryProcessor.Execute(internalQuery);

            return(internalQueryable
                   .SingleOrDefault(x => query.Name.Equals(x.Name, StringComparison.OrdinalIgnoreCase))
                   );
        }
コード例 #2
0
ファイル: RoleById.cs プロジェクト: danludwig/UCosmicAlpha
        public Role Handle(RoleById query)
        {
            if (query == null)
            {
                throw new ArgumentNullException("query");
            }

            var internalQuery = new RolesUnfiltered(query.Principal)
            {
                EagerLoad = query.EagerLoad,
            };

            var internalQueryable = _queryProcessor.Execute(internalQuery);

            return(internalQueryable
                   .SingleOrDefault(x => x.RevisionId == query.Id)
                   );
        }
コード例 #3
0
        public Role[] Handle(RolesGrantedToUserId query)
        {
            if (query == null)
            {
                throw new ArgumentNullException("query");
            }

            var internalQuery = new RolesUnfiltered(query.Principal)
            {
                EagerLoad = query.EagerLoad,
                OrderBy   = query.OrderBy,
            };

            var internalQueryable = _queryProcessor.Execute(internalQuery);

            return(internalQueryable
                   .Where(x => x.Grants.Any(y => y.User.RevisionId == query.UserId))
                   .ToArray()
                   );
        }
コード例 #4
0
        public Role[] Handle(RolesGrantedToUserName query)
        {
            if (query == null)
            {
                throw new ArgumentNullException("query");
            }

            var internalQuery = new RolesUnfiltered(query.Principal)
            {
                EagerLoad = query.EagerLoad,
                OrderBy   = query.OrderBy,
            };

            var internalQueryable = _queryProcessor.Execute(internalQuery);

            return(internalQueryable
                   .Where(x => x.Grants.Any(y => y.User.Name.Equals(query.UserName, StringComparison.OrdinalIgnoreCase)))
                   .ToArray()
                   );
        }