Code Monkey home page Code Monkey logo

cajuncoding / graphql.repodb Goto Github PK

View Code? Open in Web Editor NEW
38.0 38.0 4.0 444 KB

A set of extensions for working with HotChocolate GraphQL and Database access with micro-orms such as RepoDb (or Dapper). This extension pack provides access to key elements such as Selections/Projections, Sort arguments, & Paging arguments in a significantly simplified facade so this logic can be leveraged in the Serivces/Repositories that encapsulate all data access (without dependency on IQueryable and execution outside of the devs control).

License: MIT License

C# 98.95% TSQL 1.05%
arguments cursor-pagination dapper database-access hotchocolate hotchocolate-graphql micro-orms projection repodb repository repository-pattern resolvers selections sort-arguments sql sql-server sqlserver

graphql.repodb's People

Contributors

cajuncoding avatar davidjamesb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

graphql.repodb's Issues

Bug in IEnumerableOffsetPagingCustomExtensions.SliceAsOffsetPage

Hi. There is a bug in this line where Take() is retrieving 1 item more than it should:

var pagedResults = items.Skip(skipPast).Take(takeSome + 1).ToList();

It should be:

var pagedResults = items.Skip(skipPast).Take(takeSome).ToList();

This is particular nasty if no skip and take arguments are specified in the graphql query. In that case the value for take will be int.MaxValue = 2147483647. Adding 1 to that will cause it to wrap around to -int.MaxValue-1 = -2147483648. This causes it to always return an empty pagedResults.

Rather than relying on int.MaxValue I think it is better to instead use the default values set when calling IRequestExecutorBuilder.SetPagingOptions - however I'm not sure how to inject/access these values such that GetOffsetPagingArgsSafely can use them:

public static OffsetPagingArguments GetOffsetPagingArgsSafely(this IResolverContext context)

I didn't specific any pagination arguments on my query and I expected it to return a page size that I set as the default. I was puzzled why I kept getting back no results.

RepoDB overall refactoring of Tracing capabilities

First and foremost, you have contributed your thoughts to this story already, and, we are thanking you for that. Allow us to use this as the means of notification as you are one of the major user.

Anyway, please be informed that we are about to start the development of this User Story.

We would like to capture any comments from your side (if there are), prior to the development activity.

The changes will be part of the next "minor" release (> RepoDB v1.12.10), even it is breaking changes.

Sample.StarWars-AzureFunctions-RepoDB does not compile

The Sample.StarWars-AzureFunctions-RepoDB is out of date. It uses the older version of the extensions.

Any chance of an update?

Here are the compile errors I get (I just cloned and build that project):

3>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(4,20,4,43): error CS0234: The type or namespace name 'PreProcessingExtensions' does not exist in the namespace 'HotChocolate' (are you missing an assembly reference?)
3>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(7,20,7,43): error CS0234: The type or namespace name 'PreProcessingExtensions' does not exist in the namespace 'HotChocolate' (are you missing an assembly reference?)
3>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(8,20,8,43): error CS0234: The type or namespace name 'PreProcessingExtensions' does not exist in the namespace 'HotChocolate' (are you missing an assembly reference?)
3>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(17,23,17,37): warning CS0618: 'ExtendObjectTypeAttribute.Name.set' is obsolete: 'Use the new constructor.'
3>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(47,29,47,43): error CS0246: The type or namespace name 'IParamsContext' could not be found (are you missing a using directive or an assembly reference?)
3>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(44,27,44,63): error CS0246: The type or namespace name 'IPreProcessedCursorSlice<>' could not be found (are you missing a using directive or an assembly reference?)
3>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(83,29,83,43): error CS0246: The type or namespace name 'IParamsContext' could not be found (are you missing a using directive or an assembly reference?)
3>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(80,27,80,69): error CS0246: The type or namespace name 'IPreProcessedOffsetPageResults<>' could not be found (are you missing a using directive or an assembly reference?)
3>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(113,29,113,43): error CS0246: The type or namespace name 'IParamsContext' could not be found (are you missing a using directive or an assembly reference?)
3>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(110,27,110,57): error CS0246: The type or namespace name 'PreProcessedCursorSlice<>' could not be found (are you missing a using directive or an assembly reference?)
3>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(145,29,145,43): error CS0246: The type or namespace name 'IParamsContext' could not be found (are you missing a using directive or an assembly reference?)
3>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(142,27,142,57): error CS0246: The type or namespace name 'PreProcessedCursorSlice<>' could not be found (are you missing a using directive or an assembly reference?)
3>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(174,29,174,43): error CS0246: The type or namespace name 'IParamsContext' could not be found (are you missing a using directive or an assembly reference?)
3>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(195,29,195,43): error CS0246: The type or namespace name 'IParamsContext' could not be found (are you missing a using directive or an assembly reference?)
3>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(47,14,47,27): error CS0246: The type or namespace name 'GraphQLParamsAttribute' could not be found (are you missing a using directive or an assembly reference?)
3>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(47,14,47,27): error CS0246: The type or namespace name 'GraphQLParams' could not be found (are you missing a using directive or an assembly reference?)
3>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(83,14,83,27): error CS0246: The type or namespace name 'GraphQLParamsAttribute' could not be found (are you missing a using directive or an assembly reference?)
3>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(83,14,83,27): error CS0246: The type or namespace name 'GraphQLParams' could not be found (are you missing a using directive or an assembly reference?)
3>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(113,14,113,27): error CS0246: The type or namespace name 'GraphQLParamsAttribute' could not be found (are you missing a using directive or an assembly reference?)
3>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(113,14,113,27): error CS0246: The type or namespace name 'GraphQLParams' could not be found (are you missing a using directive or an assembly reference?)
3>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(145,14,145,27): error CS0246: The type or namespace name 'GraphQLParamsAttribute' could not be found (are you missing a using directive or an assembly reference?)
3>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(145,14,145,27): error CS0246: The type or namespace name 'GraphQLParams' could not be found (are you missing a using directive or an assembly reference?)
3>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(174,14,174,27): error CS0246: The type or namespace name 'GraphQLParamsAttribute' could not be found (are you missing a using directive or an assembly reference?)
3>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(174,14,174,27): error CS0246: The type or namespace name 'GraphQLParams' could not be found (are you missing a using directive or an assembly reference?)
3>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(195,14,195,27): error CS0246: The type or namespace name 'GraphQLParamsAttribute' could not be found (are you missing a using directive or an assembly reference?)
3>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(195,14,195,27): error CS0246: The type or namespace name 'GraphQLParams' could not be found (are you missing a using directive or an assembly reference?)
3>Done building project "StarWars-AzureFunctions-RepoDB.csproj" -- FAILED.

Package Names

hey,

could you please use not the HotChocolate.* names for your packages, this starts interfering with our own work and blocks us from extending the core framework. Moreover, it confuses users that want to consume packages from the core project.

we are in talks with the nuget team to block the packages but would like you to publish your packages under a different name.

Further, you can list your extensions with our project as community extensions so you get more traction.

Sample.StarWars-AzureFunctions-RepoDB does not compile

Same problem as previously.

Using Visual Studio I cloned the repo again, rebuild solution, and the following errors:

Build started at 11:06 PM...
1>------ Build started: Project: StarWars-AzureFunctions-RepoDB, Configuration: Debug Any CPU ------
1>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(4,20,4,43): error CS0234: The type or namespace name 'PreProcessingExtensions' does not exist in the namespace 'HotChocolate' (are you missing an assembly reference?)
1>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(7,20,7,43): error CS0234: The type or namespace name 'PreProcessingExtensions' does not exist in the namespace 'HotChocolate' (are you missing an assembly reference?)
1>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(8,20,8,43): error CS0234: The type or namespace name 'PreProcessingExtensions' does not exist in the namespace 'HotChocolate' (are you missing an assembly reference?)
1>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(17,23,17,37): warning CS0618: 'ExtendObjectTypeAttribute.Name.set' is obsolete: 'Use the new constructor.'
1>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(47,29,47,43): error CS0246: The type or namespace name 'IParamsContext' could not be found (are you missing a using directive or an assembly reference?)
1>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(44,27,44,63): error CS0246: The type or namespace name 'IPreProcessedCursorSlice<>' could not be found (are you missing a using directive or an assembly reference?)
1>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(83,29,83,43): error CS0246: The type or namespace name 'IParamsContext' could not be found (are you missing a using directive or an assembly reference?)
1>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(80,27,80,69): error CS0246: The type or namespace name 'IPreProcessedOffsetPageResults<>' could not be found (are you missing a using directive or an assembly reference?)
1>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(113,29,113,43): error CS0246: The type or namespace name 'IParamsContext' could not be found (are you missing a using directive or an assembly reference?)
1>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(110,27,110,57): error CS0246: The type or namespace name 'PreProcessedCursorSlice<>' could not be found (are you missing a using directive or an assembly reference?)
1>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(145,29,145,43): error CS0246: The type or namespace name 'IParamsContext' could not be found (are you missing a using directive or an assembly reference?)
1>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(142,27,142,57): error CS0246: The type or namespace name 'PreProcessedCursorSlice<>' could not be found (are you missing a using directive or an assembly reference?)
1>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(174,29,174,43): error CS0246: The type or namespace name 'IParamsContext' could not be found (are you missing a using directive or an assembly reference?)
1>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(195,29,195,43): error CS0246: The type or namespace name 'IParamsContext' could not be found (are you missing a using directive or an assembly reference?)
1>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(47,14,47,27): error CS0246: The type or namespace name 'GraphQLParamsAttribute' could not be found (are you missing a using directive or an assembly reference?)
1>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(47,14,47,27): error CS0246: The type or namespace name 'GraphQLParams' could not be found (are you missing a using directive or an assembly reference?)
1>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(83,14,83,27): error CS0246: The type or namespace name 'GraphQLParamsAttribute' could not be found (are you missing a using directive or an assembly reference?)
1>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(83,14,83,27): error CS0246: The type or namespace name 'GraphQLParams' could not be found (are you missing a using directive or an assembly reference?)
1>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(113,14,113,27): error CS0246: The type or namespace name 'GraphQLParamsAttribute' could not be found (are you missing a using directive or an assembly reference?)
1>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(113,14,113,27): error CS0246: The type or namespace name 'GraphQLParams' could not be found (are you missing a using directive or an assembly reference?)
1>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(145,14,145,27): error CS0246: The type or namespace name 'GraphQLParamsAttribute' could not be found (are you missing a using directive or an assembly reference?)
1>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(145,14,145,27): error CS0246: The type or namespace name 'GraphQLParams' could not be found (are you missing a using directive or an assembly reference?)
1>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(174,14,174,27): error CS0246: The type or namespace name 'GraphQLParamsAttribute' could not be found (are you missing a using directive or an assembly reference?)
1>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(174,14,174,27): error CS0246: The type or namespace name 'GraphQLParams' could not be found (are you missing a using directive or an assembly reference?)
1>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(195,14,195,27): error CS0246: The type or namespace name 'GraphQLParamsAttribute' could not be found (are you missing a using directive or an assembly reference?)
1>C:\Users\rmacfadyen\Source\Repos\GraphQL.RepoDB\Sample.StarWars-AzureFunctions-RepoDB\Characters\CharacterQueries.cs(195,14,195,27): error CS0246: The type or namespace name 'GraphQLParams' could not be found (are you missing a using directive or an assembly reference?)
1>Done building project "StarWars-AzureFunctions-RepoDB.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 4 up-to-date, 0 skipped ==========
========== Build completed at 11:06 PM and took 00.653 seconds ==========

The file Sample.StarWars-AzureFunctions-RepoDB/Characters/CharacterQueries.cs does not appear to have been updated. It continues to use out of date usings:

using HotChocolate.PreProcessingExtensions;
using HotChocolate.PreProcessingExtensions.Sorting;
using HotChocolate.PreProcessingExtensions.Pagination;

Support for .UseOffsetPaging<>()

Hi,

when using OffsetPaging there is a wrong (its too shallow) AllSelectionFields. It always contains "items" and "__typename" only.

This is pretty much showstopper for us, because we are unable to use CursorPaging.
edit: well, it isnt, we can always fork you or ctrl +c ctrl + v ;)

Is there any plan to support this?

(its actually really simple, i can send you pull request, but it is pretty much

else if (lookup.Contains("items")) // "items" is constant and it should be in SelectionNodeName
{
  var itemsSelectionField = lookup["items"].FirstOrDefault();
  var childSelections = GatherChildSelections(_resolverContext, itemsSelectionField);
  selectionResults.AddRange(childSelections);
} 
//Handle Non-paging cases; current Node is an Entity...
else 
{
...

in IResolverContextSelectionExtensions right after if (lookup.Contains(SelectionNodeName.Nodes) || lookup.Contains(SelectionNodeName.Edges)) )

The thing is, i have not idea if this break some backward compatibility or something (items is really generic name ๐Ÿคฆ )
Also, i have no idea if this break your RepoDb implementation (we dont use RepoDb)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.