Skip to content

Commit 7620053

Browse files
authored
Simplified names (#8398)
1 parent db0e58f commit 7620053

File tree

52 files changed

+110
-129
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+110
-129
lines changed

.editorconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ dotnet_diagnostic.CA1513.severity = warning
186186
# Do not initialize unnecessarily.
187187
dotnet_diagnostic.CA1805.severity = warning
188188
dotnet_diagnostic.RCS1129.severity = none
189+
# Simplify name.
190+
dotnet_diagnostic.IDE0001.severity = warning
189191
# Remove unnecessary cast.
190192
dotnet_diagnostic.IDE0004.severity = warning
191193
# Remove unnecessary using directives.

src/GreenDonut/src/GreenDonut.Data.EntityFramework/Extensions/PagingQueryableExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ public static ValueTask<Dictionary<TKey, Page<TValue>>> ToBatchPageAsync<TKey, T
273273
PagingArguments arguments,
274274
CancellationToken cancellationToken = default)
275275
where TKey : notnull
276-
=> ToBatchPageAsync<TKey, TValue, TValue>(
276+
=> ToBatchPageAsync(
277277
source,
278278
keySelector,
279279
t => t,
@@ -315,7 +315,7 @@ public static ValueTask<Dictionary<TKey, Page<TValue>>> ToBatchPageAsync<TKey, T
315315
bool includeTotalCount,
316316
CancellationToken cancellationToken = default)
317317
where TKey : notnull
318-
=> ToBatchPageAsync<TKey, TValue, TValue>(
318+
=> ToBatchPageAsync(
319319
source,
320320
keySelector,
321321
t => t,

src/GreenDonut/src/GreenDonut/DataLoaderBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ async ValueTask StartDispatchingAsync()
358358
var context = new DataLoaderFetchContext<TValue>(ContextData);
359359
await FetchAsync(batch.Keys, buffer, context, cancellationToken).ConfigureAwait(false);
360360
BatchOperationSucceeded(batch, batch.Keys, buffer);
361-
_diagnosticEvents.BatchResults<TKey, TValue>(batch.Keys, buffer);
361+
_diagnosticEvents.BatchResults(batch.Keys, buffer);
362362
}
363363
catch (Exception ex)
364364
{

src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/TestContext/AnimalContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
1616
protected override void OnModelCreating(ModelBuilder modelBuilder)
1717
{
1818
modelBuilder.Entity<Owner>()
19-
.HasMany<Animal>(o => o.Pets)
19+
.HasMany(o => o.Pets)
2020
.WithOne(t => t.Owner)
2121
.HasForeignKey(t => t.OwnerId)
2222
.HasPrincipalKey(o => o.Id);

src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/AuthenticatedDescriptionExtensions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,28 @@ public static IEnumTypeDescriptor Authenticated(this IEnumTypeDescriptor descrip
2929
return descriptor.Directive(AuthenticatedDirective.Default);
3030
}
3131

32-
/// <inheritdoc cref="Authenticated(HotChocolate.Types.IEnumTypeDescriptor)"/>
32+
/// <inheritdoc cref="Authenticated(IEnumTypeDescriptor)"/>
3333
public static IInterfaceFieldDescriptor Authenticated(this IInterfaceFieldDescriptor descriptor)
3434
{
3535
ArgumentNullException.ThrowIfNull(descriptor);
3636
return descriptor.Directive(AuthenticatedDirective.Default);
3737
}
3838

39-
/// <inheritdoc cref="Authenticated(HotChocolate.Types.IEnumTypeDescriptor)"/>
39+
/// <inheritdoc cref="Authenticated(IEnumTypeDescriptor)"/>
4040
public static IInterfaceTypeDescriptor Authenticated(this IInterfaceTypeDescriptor descriptor)
4141
{
4242
ArgumentNullException.ThrowIfNull(descriptor);
4343
return descriptor.Directive(AuthenticatedDirective.Default);
4444
}
4545

46-
/// <inheritdoc cref="Authenticated(HotChocolate.Types.IEnumTypeDescriptor)"/>
46+
/// <inheritdoc cref="Authenticated(IEnumTypeDescriptor)"/>
4747
public static IObjectFieldDescriptor Authenticated(this IObjectFieldDescriptor descriptor)
4848
{
4949
ArgumentNullException.ThrowIfNull(descriptor);
5050
return descriptor.Directive(AuthenticatedDirective.Default);
5151
}
5252

53-
/// <inheritdoc cref="Authenticated(HotChocolate.Types.IEnumTypeDescriptor)"/>
53+
/// <inheritdoc cref="Authenticated(IEnumTypeDescriptor)"/>
5454
public static IObjectTypeDescriptor Authenticated(this IObjectTypeDescriptor descriptor)
5555
{
5656
ArgumentNullException.ThrowIfNull(descriptor);

src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/PolicyDescriptorExtensions.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public static IEnumTypeDescriptor Policy(
7878
return descriptor;
7979
}
8080

81-
/// <inheritdoc cref="PolicyDescriptorExtensions.Policy(IEnumTypeDescriptor, IReadOnlyList{HotChocolate.ApolloFederation.Types.Policy})"/>
81+
/// <inheritdoc cref="Policy(IEnumTypeDescriptor, IReadOnlyList{Types.Policy})"/>
8282
public static IInterfaceFieldDescriptor Policy(
8383
this IInterfaceFieldDescriptor descriptor,
8484
IReadOnlyList<Policy> policies)
@@ -94,7 +94,7 @@ public static IInterfaceFieldDescriptor Policy(
9494
return descriptor;
9595
}
9696

97-
/// <inheritdoc cref="PolicyDescriptorExtensions.Policy(IEnumTypeDescriptor, IReadOnlyList{string})"/>
97+
/// <inheritdoc cref="Policy(IEnumTypeDescriptor, IReadOnlyList{string})"/>
9898
public static IInterfaceFieldDescriptor Policy(
9999
this IInterfaceFieldDescriptor descriptor,
100100
IReadOnlyList<string> policies)
@@ -110,7 +110,7 @@ public static IInterfaceFieldDescriptor Policy(
110110
return descriptor;
111111
}
112112

113-
/// <inheritdoc cref="PolicyDescriptorExtensions.Policy(IEnumTypeDescriptor, IReadOnlyList{HotChocolate.ApolloFederation.Types.Policy})"/>
113+
/// <inheritdoc cref="Policy(IEnumTypeDescriptor, IReadOnlyList{Types.Policy})"/>
114114
public static IInterfaceTypeDescriptor Policy(
115115
this IInterfaceTypeDescriptor descriptor,
116116
IReadOnlyList<Policy> policies)
@@ -126,7 +126,7 @@ public static IInterfaceTypeDescriptor Policy(
126126
return descriptor;
127127
}
128128

129-
/// <inheritdoc cref="PolicyDescriptorExtensions.Policy(IEnumTypeDescriptor, IReadOnlyList{string})"/>
129+
/// <inheritdoc cref="Policy(IEnumTypeDescriptor, IReadOnlyList{string})"/>
130130
public static IInterfaceTypeDescriptor Policy(
131131
this IInterfaceTypeDescriptor descriptor,
132132
IReadOnlyList<string> policies)
@@ -142,7 +142,7 @@ public static IInterfaceTypeDescriptor Policy(
142142
return descriptor;
143143
}
144144

145-
/// <inheritdoc cref="PolicyDescriptorExtensions.Policy(IEnumTypeDescriptor, IReadOnlyList{HotChocolate.ApolloFederation.Types.Policy})"/>
145+
/// <inheritdoc cref="Policy(IEnumTypeDescriptor, IReadOnlyList{Types.Policy})"/>
146146
public static IObjectFieldDescriptor Policy(
147147
this IObjectFieldDescriptor descriptor,
148148
IReadOnlyList<Policy> policies)
@@ -158,7 +158,7 @@ public static IObjectFieldDescriptor Policy(
158158
return descriptor;
159159
}
160160

161-
/// <inheritdoc cref="PolicyDescriptorExtensions.Policy(IEnumTypeDescriptor, IReadOnlyList{string})"/>
161+
/// <inheritdoc cref="Policy(IEnumTypeDescriptor, IReadOnlyList{string})"/>
162162
public static IObjectFieldDescriptor Policy(
163163
this IObjectFieldDescriptor descriptor,
164164
IReadOnlyList<string> policies)
@@ -174,7 +174,7 @@ public static IObjectFieldDescriptor Policy(
174174
return descriptor;
175175
}
176176

177-
/// <inheritdoc cref="PolicyDescriptorExtensions.Policy(IEnumTypeDescriptor, IReadOnlyList{HotChocolate.ApolloFederation.Types.Policy})"/>
177+
/// <inheritdoc cref="Policy(IEnumTypeDescriptor, IReadOnlyList{Types.Policy})"/>
178178
public static IObjectTypeDescriptor Policy(
179179
this IObjectTypeDescriptor descriptor,
180180
IReadOnlyList<Policy> policies)
@@ -190,7 +190,7 @@ public static IObjectTypeDescriptor Policy(
190190
return descriptor;
191191
}
192192

193-
/// <inheritdoc cref="PolicyDescriptorExtensions.Policy(IEnumTypeDescriptor, IReadOnlyList{string})"/>
193+
/// <inheritdoc cref="Policy(IEnumTypeDescriptor, IReadOnlyList{string})"/>
194194
public static IObjectTypeDescriptor Policy(
195195
this IObjectTypeDescriptor descriptor,
196196
IReadOnlyList<string> policies)

src/HotChocolate/AspNetCore/src/AspNetCore.Authorization/Extensions/HotChocolateAuthorizeRequestExecutorBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public static IRequestExecutorBuilder AddAuthorization(
3838
/// </param>
3939
/// <param name="configure">
4040
/// An action delegate to configure the provided
41-
/// <see cref="Microsoft.AspNetCore.Authorization.AuthorizationOptions"/>.
41+
/// <see cref="AspNetCore.Authorization.AuthorizationOptions"/>.
4242
/// </param>
4343
/// <returns>
4444
/// Returns the <see cref="IRequestExecutorBuilder"/> for chaining in more configurations.

src/HotChocolate/AspNetCore/src/AspNetCore/GraphQLToolServeMode.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,24 @@ namespace HotChocolate.AspNetCore;
88
/// <list type="bullet">
99
/// <item>
1010
/// <description>
11-
/// <see cref="GraphQLToolServeMode.Latest"/>: Uses the latest version of the tool, served over the
11+
/// <see cref="Latest"/>: Uses the latest version of the tool, served over the
1212
/// cdn.
1313
/// </description>
1414
/// </item>
1515
/// <item>
1616
/// <description>
17-
/// <see cref="GraphQLToolServeMode.Insider"/>: Uses the insider version of the tool, served over
17+
/// <see cref="Insider"/>: Uses the insider version of the tool, served over
1818
/// the CDN.
1919
/// </description>
2020
/// </item>
2121
/// <item>
2222
/// <description>
23-
/// <see cref="GraphQLToolServeMode.Embedded"/>: Uses the tool's embedded files in the package.
23+
/// <see cref="Embedded"/>: Uses the tool's embedded files in the package.
2424
/// </description>
2525
/// </item>
2626
/// </list>
2727
/// In addition, a specific version of the tool can be served over the CDN using the
28-
/// <see cref="GraphQLToolServeMode.Version(string)"/> method.
28+
/// <see cref="Version(string)"/> method.
2929
/// <example>
3030
/// <para>
3131
/// The following example shows how to serve the embedded version of the tool:

src/HotChocolate/Core/src/Execution/DependencyInjection/InternalServiceCollectionExtensions.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ internal static IServiceCollection TryAddVariableCoercion(
4141
internal static IServiceCollection TryAddResultPool(
4242
this IServiceCollection services)
4343
{
44-
services.TryAddSingleton<ResultBufferOptions>(sp =>
44+
services.TryAddSingleton(sp =>
4545
{
4646
var options = new ResultBufferOptions();
4747
var modifiers = sp.GetServices<Action<ResultBufferOptions>>();
@@ -162,8 +162,7 @@ internal static IServiceCollection TryAddRequestExecutorResolver(
162162
internal static IServiceCollection TryAddDefaultCaches(
163163
this IServiceCollection services)
164164
{
165-
services.TryAddSingleton<PreparedOperationCacheOptions>(
166-
_ => new PreparedOperationCacheOptions { Capacity = 256 });
165+
services.TryAddSingleton(_ => new PreparedOperationCacheOptions { Capacity = 256 });
167166
services.TryAddSingleton<IDocumentCache>(
168167
sp => new DefaultDocumentCache(
169168
sp.GetRequiredService<PreparedOperationCacheOptions>().Capacity));
@@ -194,7 +193,7 @@ internal static IServiceCollection TryAddDefaultDataLoaderRegistry(
194193
services.RemoveAll<IDataLoaderScope>();
195194
services.TryAddSingleton<DataLoaderScopeHolder>();
196195
services.TryAddScoped<IDataLoaderScopeFactory, ExecutionDataLoaderScopeFactory>();
197-
services.TryAddScoped<IDataLoaderScope>(
196+
services.TryAddScoped(
198197
sp => sp.GetRequiredService<DataLoaderScopeHolder>().GetOrCreateScope(sp));
199198
return services;
200199
}

src/HotChocolate/Core/src/Execution/DependencyInjection/RequestExecutorBuilderExtensions.DataLoader.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public static IRequestExecutorBuilder AddDataLoader<T>(
1212
where T : class, IDataLoader
1313
{
1414
builder.Services.AddSingleton(new DataLoaderRegistration(typeof(T)));
15-
builder.Services.TryAddScoped<T>(sp => sp.GetDataLoader<T>());
15+
builder.Services.TryAddScoped(sp => sp.GetDataLoader<T>());
1616
return builder;
1717
}
1818

@@ -22,8 +22,8 @@ public static IRequestExecutorBuilder AddDataLoader<TService, TImplementation>(
2222
where TImplementation : class, TService
2323
{
2424
builder.Services.AddSingleton(new DataLoaderRegistration(typeof(TService), typeof(TImplementation)));
25-
builder.Services.TryAddScoped<TImplementation>(sp => sp.GetDataLoader<TImplementation>());
26-
builder.Services.TryAddScoped<TService>(sp => sp.GetDataLoader<TService>());
25+
builder.Services.TryAddScoped(sp => sp.GetDataLoader<TImplementation>());
26+
builder.Services.TryAddScoped(sp => sp.GetDataLoader<TService>());
2727
return builder;
2828
}
2929

@@ -33,7 +33,7 @@ public static IRequestExecutorBuilder AddDataLoader<T>(
3333
where T : class, IDataLoader
3434
{
3535
builder.Services.AddSingleton(new DataLoaderRegistration(typeof(T), sp => factory(sp)));
36-
builder.Services.TryAddScoped<T>(sp => sp.GetDataLoader<T>());
36+
builder.Services.TryAddScoped(sp => sp.GetDataLoader<T>());
3737
return builder;
3838
}
3939

@@ -44,8 +44,8 @@ public static IRequestExecutorBuilder AddDataLoader<TService, TImplementation>(
4444
where TImplementation : class, TService
4545
{
4646
builder.Services.AddSingleton(new DataLoaderRegistration(typeof(TService), typeof(TImplementation), sp => factory(sp)));
47-
builder.Services.TryAddScoped<TImplementation>(sp => sp.GetDataLoader<TImplementation>());
48-
builder.Services.TryAddScoped<TService>(sp => sp.GetDataLoader<TService>());
47+
builder.Services.TryAddScoped(sp => sp.GetDataLoader<TImplementation>());
48+
builder.Services.TryAddScoped(sp => sp.GetDataLoader<TService>());
4949
return builder;
5050
}
5151
}

0 commit comments

Comments
 (0)