Skip to content

Latest commit

 

History

History
31 lines (26 loc) · 949 Bytes

CONTRIBUTION.md

File metadata and controls

31 lines (26 loc) · 949 Bytes

Contribution

Code Style

Rules

Extension Methods

  • Extension files should always begin with the type name and end with Extensions. Examples:
    • StringExtensions.cs
    • ServiceCollectionExtensions.cs
  • Write for every type a separate extension file.
  • Use the origin namespace of the type; use HotChocolate when extending an external type like Microsoft.Ectensions.DependencyInjection.IServiceCollection or HotChocolate.AspNetCore when extending a ASP.net core specific type like Microsoft.AspNetCore.Builder.IApplicationBuilder. Example:
    using Microsoft.Extensions.DependencyInjection;
    
    namespace HotChocolate
    {
        public static class ServiceCollectionExtensions
        {
            public static IServiceCollection AddGraphQL(
                this IServiceCollection serviceCollection,
                ISchema schema)
            {
                // omitted for brevity
            }
        }
    }