コード例 #1
0
ファイル: PermissionCache.cs プロジェクト: lulzzz/allors2
        public PermissionCache(ISession session)
        {
            var permissions = new Permissions(session).Extent();

            session.Prefetch(PrefetchPolicy, permissions);

            this.PermissionIdByOperationByOperandTypeIdByClassId = permissions
                                                                   .GroupBy(v => v.ConcreteClass.Id).ToDictionary(v => v.Key,
                                                                                                                  w => w.GroupBy(v => v.OperandType.Id).ToDictionary(v => v.Key, x =>
                                                                                                                                                                     x.ToDictionary(v => v.Operation, y => y.Id)));
        }
コード例 #2
0
        public PermissionCache(ISession session)
        {
            var permissions = new Permissions(session).Extent();

            session.Prefetch(PrefetchPolicy, permissions);

            this.PermissionIdByOperationByOperandTypeIdByClassId = permissions
                                                                   .GroupBy(v => v.ConcreteClass.Id)
                                                                   .ToDictionary(
                v => v.Key,
                w => w.GroupBy(v => v.OperandType.Id).ToDictionary(v => v.Key, x =>
                                                                   x.ToDictionary(v => v.Operation, y => y.Id)));

            this.SortedWorkspacePermissionIdsByClassId = permissions
                                                         .Where(v => (v.OperandType as RoleType)?.Workspace == true || (v.OperandType as MethodType)?.Workspace == true)
                                                         .GroupBy(v => v.ConcreteClass.Id)
                                                         .ToDictionary(
                v => v.Key,
                w => w.Select(x => x.Id).OrderBy(x => x).ToArray());
        }