From 15904e0ed0d2a55d579b8adf334c3a19c8de11aa Mon Sep 17 00:00:00 2001 From: Sanchime Date: Sun, 27 Nov 2022 17:36:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A8=E6=80=81=E5=8A=A0=E8=BD=BD=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E6=8E=A7=E5=88=B6=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Web/{ServiceConvention.cs => StarletConvention.cs} | 2 +- .../Web/{ServiceExtension.cs => StarletExtension.cs} | 8 +++++++- ...erviceFeatureProvider.cs => StarletFeatureProvider.cs} | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) rename Dipper.Alioth/Web/{ServiceConvention.cs => StarletConvention.cs} (98%) rename Dipper.Alioth/Web/{ServiceExtension.cs => StarletExtension.cs} (90%) rename Dipper.Alioth/Web/{ServiceFeatureProvider.cs => StarletFeatureProvider.cs} (85%) diff --git a/Dipper.Alioth/Web/ServiceConvention.cs b/Dipper.Alioth/Web/StarletConvention.cs similarity index 98% rename from Dipper.Alioth/Web/ServiceConvention.cs rename to Dipper.Alioth/Web/StarletConvention.cs index bad72cd..0a36dbb 100644 --- a/Dipper.Alioth/Web/ServiceConvention.cs +++ b/Dipper.Alioth/Web/StarletConvention.cs @@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Mvc.ApplicationModels; namespace Dipper.Alioth.Web; -public class ServiceConvention : IApplicationModelConvention +public class StarletConvention : IApplicationModelConvention { public void Apply(ApplicationModel application) { diff --git a/Dipper.Alioth/Web/ServiceExtension.cs b/Dipper.Alioth/Web/StarletExtension.cs similarity index 90% rename from Dipper.Alioth/Web/ServiceExtension.cs rename to Dipper.Alioth/Web/StarletExtension.cs index 24538f7..f28bd87 100644 --- a/Dipper.Alioth/Web/ServiceExtension.cs +++ b/Dipper.Alioth/Web/StarletExtension.cs @@ -3,13 +3,14 @@ using Dipper.Alioth.Providers; using Dipper.Alioth.Starlets; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.ApplicationParts; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; namespace Dipper.Alioth.Web; -public static class ServiceExtension +public static class StarletExtension { public static WebApplicationBuilder AddStarApp(this WebApplicationBuilder builder, Action? action = null) { @@ -65,5 +66,10 @@ public static class ServiceExtension manager.FeatureProviders.Add(new ApiFeatureProvider()); }); + + builder.Services.Configure(options => + { + options.Conventions.Add(new StarletConvention()); + }); } } \ No newline at end of file diff --git a/Dipper.Alioth/Web/ServiceFeatureProvider.cs b/Dipper.Alioth/Web/StarletFeatureProvider.cs similarity index 85% rename from Dipper.Alioth/Web/ServiceFeatureProvider.cs rename to Dipper.Alioth/Web/StarletFeatureProvider.cs index cca6595..c04efd9 100644 --- a/Dipper.Alioth/Web/ServiceFeatureProvider.cs +++ b/Dipper.Alioth/Web/StarletFeatureProvider.cs @@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc.Controllers; namespace Dipper.Alioth.Web; -public class ServiceFeatureProvider : ControllerFeatureProvider +public class StarletFeatureProvider : ControllerFeatureProvider { protected override bool IsController(TypeInfo typeInfo) {