❔ HotChocolate with IQueryable, apply a required filter on the ef entity
Basically, I'm trying to find a way to configure an
IObjectFieldDescriptor
by adding a required argument to it, which should in turn apply a filter on the database entity. In this case, I'm adding a companyId
argument, and then applying the respective filter manually, before mapping. What should I do to configure this in a simpler way? Let me show you what I have and then what I mean by a better way.
This is what I have so far. Don't mind the FieldCollectionQuery
and UseBuiltinMiddleware
extension methods, they are there to set up the ef core stuff. The argument is the important bit right now.
A
Anton•414d ago
And what it should look like in my mind:
This looks like I need to split off the
ProjectTo
call into a middleware that's a bit higher up in the chain, and then apply the filter via another middleware that's just above Resolve
.
Any ideas?
Ah yes, forgot to mention, I also need to validate the whether the user has access to that company, whose id was passed in, which is why using a where filter here won't do.A
Accord•413d ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
52KMembers
View on DiscordWant results from more Discord servers?
More Posts❔ Dev/prod databseHello,
Me and a friend wants to create a webb-app project with a react frontend and C# backend.
❔ Book recommendation to learn c#/dotnetI've been programming in python for a little under two years. I am starting a new job in c#.
Whats a❔ Use `this` inside method decoratorTried to follow https://stackoverflow.com/a/2966758
```cs
[AttributeUsage(AttributeTargets.Metho✅ How can I make VSCode auto add semicolons to statements on save?I'm coming from the world of Javascript and Typescript. There, you can just use Prettier to automati❔ Find common substring at start of every string in listI have a list of Windows path strings and I want to determine the common beginning shared by all of ❔ Code is completely skipping over an areaI'm writing a script for a game where if you don't press Spacebar within 4 seconds, the number of fa❔ Registering an extracted appx package```csharp
public static void RegisterMinecraftAppxPackage(string appxPackagePath) {
try {
✅ Exception Handling for NRE without modifying every call.I have a ReadData function which reads the memory of a process. If the process exits or crashes duri