Skip to content

Having problem when applying filter on child collection #130

@elferone

Description

@elferone

I have a class Project that contains a collection of ProjectResourceMembers.

My filter is defined like this:

//Security
                modelBuilder.Filter("ProjectFilter",
                    (Project p, string resourceCode) => (p.ProjectResourceMembers.Any(x => x.ResourceCode.ToLower() == GetResourceCodeFromPrincipal(Thread.CurrentPrincipal)) 
                    && p.IsConfidential == true) || p.IsConfidential == false,
                    () => GetResourceCodeFromPrincipal(Thread.CurrentPrincipal));

                modelBuilder.EnableFilter("ProjectFilter", () => !string.IsNullOrEmpty(GetResourceCodeFromPrincipal(Thread.CurrentPrincipal)));

However, when I query the context (via OData), I get this exception:

variable 'x' of type 'DataHub.Provider.Models.Atomic.ProjectResourceMember' referenced from scope '', but it is not defined

The error seems to be related to x.ResourceCode.ToLower()... Any idea what the error might be?

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions