This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.Linq; | |
using System.Reflection; | |
using HotChocolate.Configuration; | |
using HotChocolate.Types.Descriptors; | |
using HotChocolate.Types.Descriptors.Definitions; | |
namespace HotChocolate.Types.Relay | |
{ | |
/// <summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Collections.Immutable; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using HotChocolate; | |
using HotChocolate.Execution; | |
using HotChocolate.Language; | |
using HotChocolate.Resolvers; | |
using HotChocolate.Stitching; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Net; | |
using System.Threading.Tasks; | |
using Microsoft.AspNetCore.Mvc.Testing; | |
using Snapshooter.Json; | |
using Xunit; | |
namespace MyCompany.MyService | |
{ | |
public class GraphQLSchemaTests | |
: IClassFixture<WebApplicationFactory<Startup>> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A middleware to provide resolvers with their own, scoped instance, of a service. Example here is IMediator, but this could be made generic. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#nullable enable | |
using Microsoft.EntityFrameworkCore; | |
namespace MyCompany | |
{ | |
/// <summary> | |
/// An abstraction around EF Core's DbContextPool (as it's an internal API that becomes public in .NET 5) | |
/// for renting a DbContext. | |
/// </summary> | |
public interface IDbContextPool<TDbContext> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Prevents use of certain field names typically used in introspection queries. | |
/// Useful for production environments where you may want to guard against such queries. | |
/// </summary> | |
/// <remarks> | |
/// Compatible with v10 of HotChocolate. | |
/// </summary> | |
public class NoIntrospectionValidationRule : IQueryValidationRule | |
{ | |
private static readonly HashSet<string> _bannedFieldNames = new HashSet<string>() { "__schema", "__type" }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
schema_name(tab.schema_id) as schema_name, | |
tab.name as table_name, | |
--col.column_id, | |
col.name as column_name, | |
col.is_nullable, | |
t.name as data_type, | |
col.precision, | |
col.scale | |
from sys.tables as tab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const string sourcePath = @"C:\src\autoguru\src\Microservices"; | |
const string enabledHeader = "#nullable enable"; | |
const string disabledHeader = "#nullable disable"; | |
var files = Directory.GetFiles(sourcePath, "*.cs", SearchOption.AllDirectories); | |
var projFiles = Directory.GetFiles(sourcePath, "*.csproj", SearchOption.AllDirectories); | |
foreach (var file in files) | |
{ | |
var contents = File.ReadAllText(file); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare @SearchTerm nvarchar(4000) -- Can be max for SQL2005+ | |
declare @ColumnName sysname | |
-------------------------------------------------------------------------------- | |
-- SET THESE! | |
-------------------------------------------------------------------------------- | |
set @SearchTerm = N'285' -- Term to be searched for, wildcards okay | |
set @ColumnName = N'ShippingSuburbID' -- Use to restrict the search to certain columns, wildcards okay, null or empty string for all cols | |
-------------------------------------------------------------------------------- | |
-- END SET |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Custom naming conventions. | |
/// | |
/// Usage in v10: | |
/// <c>services.AddSingleton<INamingConventions, NamingConventions>()</c> | |
/// <c>IRequestExecutorBuilder.AddConvention<INamingConventions>(new NamingConventions())</c> | |
/// Usage in v11: | |
/// | |
/// </summary> | |
public class NamingConventions : DefaultNamingConventions |