In GraphQl dot net how we can get projected field names from ResolveFieldContext - graphql-dotnet

I am new in Graphql and using graphql-dotnet in my asp.net core project.
Consider I have written a query like following.
restaurants {
id
name
}
Now I want to get this field names from ResolveFieldContext. Is there any way to get this filed names?
Expecting your valuable help.

According to https://github.com/graphql-dotnet/graphql-dotnet/issues/903
The solution is we need to use SubFields to get projected fields

Related

https://graph.microsoft.com/v1.0/deviceAppManagement/managedAppRegistrations filter on bundleId or packageId

I am trying to retrieve info from intune via GraphApi.
Want to filter on bundleId or packageId field (located under appIdentifier).
But I can't seem to find a way to do this.
Target result is :
userId,os_type (based on either #odata.type or packageId/bundleId).
Step further is that i want to identify certain apps by filtering on for example startswith(packageId,'com.microsoft').
I have tried combinations on "/deviceAppManagement/managedAppRegistrations?$filter=startswith(bundleId,'com.m'). But I keep on ending up on "invalid filter clause" whenever i want to execute a filter action.
Trying to recover from microsoft documentation if any filtering is possible on this part of graph seems impossible.
Currently we are using power automate to retrieve data and that works if we don't filter / select.
screenshot of json result
Use the following filter: startsWith(microsoft.graph.iosVppApp/bundleId, 'com.microsoft')
I found a pointer at this reddit post: https://www.reddit.com/r/Intune/comments/cxkwm3/using_graph_to_show_all_apps_from_one_vpp_token/

Filter based on annotation property in CRM WEP API

I am using the CRM WEB API 2016 v8.1.
I need to filter data based on annotaion property like this one _objectid_value#Microsoft.Dynamics.CRM.lookuplogicalname
Anyone know how to do that or if it is implemented or not?
If i understand you correctly you want to filter data from (for example) a lookup field in a record.
It is possible to filter with a single record.
Example:
GET [Organization URI]/api/data/v8.2/accounts(00000000-0000-0000-0000-000000000001)?$expand=Account_Tasks($filter=endswith(subject,'1');$select=subject)
But it look like it's not yet possible to filter multiple record using $expand
source:
https://msdn.microsoft.com/en-us/library/mt607871.aspx?f=255&MSPPError=-2147217396#bkmk_optionsOnExpand

Doctrine filtering with precalculation

I'm having trouble figuring if there is a better way to filter array collection
.
This is my code:
$searchResults = $this->get('app.user.repository')->getUsersBySearchData($searchDetails);
$searchResults->filter(
function($user) use ($searchDetails){
$distance = $this->get('app.distance.calculator')->calculateDistance($user->getCity(), $searchDetails->getCity());
$distanceToTravel = $user->getDistanceToTravel();
if($distance < $distanceToTravel)
return true;
return false;
}
);
This returns all users from $searchResults filtered from already fetched collection.
I need to fetch all users form database whose location is not beyond distance which user enters in his profile and city entered in search form. To determine if that distance is not exceeded i have to calculate distance between location entered in search form to location of user and compare that distance to user profile distance.
Is it possible to do this kind of filtering on database level? I looked into Criteria API but couuldn't figure out how to do it.
Since you use an external module for filtering this is not possible. You should somehow be able to move filtering to database level. Since you need to add support for filtering to different locations I would suggest you store the locations in the database in a way that you can use them for filtering. Simply adding the name of the city will not be enough information.
I would like to suggest that you add longitude (location_longitude) and latitude (location_latitude) of your cities in the database and use this in your SQL query for filtering.
Check also this question for reference
You could also make a custom location mapping inside doctrine for making things work a bit smoother. Check the doctrine documentation chapter Advanced field value conversion using custom mapping types for an example.
This example is explaining a DBAL type a where a location (point) is stored in latitude and longitude values in the database.

How to use Catalyst to search, select and display entries from my database

I have to use Catalyst in order to create a database and access it through a browser.
I have created a very simple database using DBIx-class and sqlite, just one table and filled it with some records.
I have managed to display the whole table and its rows using Template Toolkit view module and the code below into my controller.
$c->stash(ptm => [$c->model('DB::ptm')->all]);
Now I have created a simple search box in order to search the database and display any entries that match with the keyword, but I don't know how to pass the keyword to my controller nor how to implement the subroutine in order to achieve this.
I have searched for more than three days without finding any solution.
There are two completely different problems here.
Accepting arguments in Catalyst
Performing a search in DBIC
So, starting with the first one. Reading a query string.
$c->request->query_parameters->{field}
Then performing a search. Just call search instead of all and pass a hashref of your columns and values.
$c->model('DB::ptm')->search( { 'name' => $tag } );

Ravendb - 'selecting' collection entities from parent entities

I am trying to create an index in raven that will (to all intents and purposes) project all comments on all blog-posts that were created by a specific user. At present I have managed a map statement, which only returns the posts that have comments.
from post in docs.Posts
from comment in Hierarchy(post, "Comments")
select new { comment.User, comment.Text }
At the end of this, I will want to page through the comments, so I need to get a flat list of all matching items.
Thanks
What is the problem that you have run to?
You are projecting the comment data out, you need to tell RavenDB to store the fields, but you can now query it just fine.

Resources