GraphQL.Annotations.TSql.AspNetCore 0.1.5

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package GraphQL.Annotations.TSql.AspNetCore --version 0.1.5
NuGet\Install-Package GraphQL.Annotations.TSql.AspNetCore -Version 0.1.5
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GraphQL.Annotations.TSql.AspNetCore" Version="0.1.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add GraphQL.Annotations.TSql.AspNetCore --version 0.1.5
#r "nuget: GraphQL.Annotations.TSql.AspNetCore, 0.1.5"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install GraphQL.Annotations.TSql.AspNetCore as a Cake Addin
#addin nuget:?package=GraphQL.Annotations.TSql.AspNetCore&version=0.1.5

// Install GraphQL.Annotations.TSql.AspNetCore as a Cake Tool
#tool nuget:?package=GraphQL.Annotations.TSql.AspNetCore&version=0.1.5

GraphQL.Annotations.TSql

Build Status SemVer Nuget

C# Library for adding objects which map to TSQL Tables to a graphql schema, Intended to be used with the GraphQL package on nuget. A sample project is included with the db schema required to run it. The client side code is based on the react ui from haikyuu/graphql-todo-list

Usage

If you get confused with these instructions refer to the GraphQL.Annotations.ToDo.Example project

Setup

  1. Add the GraphQL.Annotations.TSql nuget package
  2. Create your schema, query, and mutation objects and add them to DI
  3. Add IServiceProvider as a constructor parameter to both your Query and Mutation types
  4. Add this.AddGraphQLTSqlMutationFields<Mutation>(serviceProvider); inside the constructor of the mutation class
  5. Add this.AddGraphQLTSqlQueryFields<Query>(serviceProvider); inside the constructor of the query class.
  6. Add services.AddGraphQLTSql<Query, Mutation>(); inside your Startup.ConfigureServices method
  7. Create a class implementing ISqlConnectionGetter and add it to DI using the interface. This class will be used to create all connections, the return value of the GetConnection method will be automatically disposed
  8. If you are using the GraphQL.Server package with Asp.Net
    1. Add the GraphQL.Annotations.TSql.AspNetCore package
    2. Add .AddHttpContextUserContextBuilder() to the end of your services.AddGraphQL call

Creating objects

This library is based on the GraphQL.Annotations library and uses similar syntax

For query only objects

This is the simpler case and will only add the object to your query type

  1. Inherit from SqlFieldResolver<T> filling in the class name as the type argument
  2. Create properties and annotate them using SqlGraphQLField. Each field must be nullable otherwise you will run into runtime errors
    • You should not start any of your fields with an _ all system fields will start with one and using them will potentially result in naming conflicts
  3. Implement the Table, DefaultOrder, and PrimaryProperty properties
    • Table is the table or view that this object is bound to
    • DefaultOrder is the property which will be used for ordering by default. Use the property name, not the sql field name
    • PrimaryProperty is the field which contains the primary key. Use the property name, not the sql field name. This MUST return a unique value per row, it is advised that this is also indexed
  4. Add the GraphQLObject attribute to the class

For mutable objects

These are a little more involved documentation is in the wiki

Querying objects

The documentation for querying should be in the resulting graphql schema. Some of the potential problems and things to watch out for are in the wiki

Additional features can be found in the wiki.

Releasing

All Pull Requests should be available as a prerelease on nuget.org. To create an official release create a release in github with the new version number, after the build completes it will be uploaded to nuget.org

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated