尝试移除part
This commit is contained in:
parent
15904e0ed0
commit
6c23330c62
|
@ -1,14 +1,4 @@
|
||||||
using Dipper.Alioth.Options;
|
namespace Dipper.Alioth.Extensions;
|
||||||
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 StarletExtension
|
public static class StarletExtension
|
||||||
{
|
{
|
||||||
|
@ -64,7 +54,7 @@ public static class StarletExtension
|
||||||
manager.ApplicationParts.Add(new AssemblyPart(assembly));
|
manager.ApplicationParts.Add(new AssemblyPart(assembly));
|
||||||
}
|
}
|
||||||
|
|
||||||
manager.FeatureProviders.Add(new ApiFeatureProvider());
|
manager.FeatureProviders.Add(new Providers.StarletFeatureProvider());
|
||||||
});
|
});
|
||||||
|
|
||||||
builder.Services.Configure<MvcOptions>(options =>
|
builder.Services.Configure<MvcOptions>(options =>
|
|
@ -1,5 +1,3 @@
|
||||||
using Dipper.Alioth.Web;
|
|
||||||
|
|
||||||
namespace Dipper.Alioth.Extensions;
|
namespace Dipper.Alioth.Extensions;
|
||||||
|
|
||||||
public static class StartHostExtension
|
public static class StartHostExtension
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
global using Dipper.Alioth.Options;
|
||||||
|
global using Dipper.Alioth.Providers;
|
||||||
|
global using Dipper.Alioth.Starlets;
|
||||||
|
global using Dipper.Alioth.Web;
|
||||||
|
global using Dipper.Alioth.Extensions;
|
||||||
|
global using Microsoft.AspNetCore.Builder;
|
||||||
|
global using Microsoft.AspNetCore.Http;
|
||||||
|
global using Microsoft.AspNetCore.Mvc;
|
||||||
|
global using Microsoft.AspNetCore.Mvc.ApplicationParts;
|
||||||
|
global using Microsoft.Extensions.DependencyInjection;
|
||||||
|
global using Microsoft.Extensions.Hosting;
|
|
@ -1,20 +0,0 @@
|
||||||
using Dipper.Alioth.Starlets;
|
|
||||||
using Microsoft.AspNetCore.Mvc.ApplicationParts;
|
|
||||||
|
|
||||||
namespace Dipper.Alioth;
|
|
||||||
|
|
||||||
public class ManagerStarlet : IStarlet
|
|
||||||
{
|
|
||||||
private ApplicationPartManager _partManager;
|
|
||||||
|
|
||||||
|
|
||||||
public ManagerStarlet(ApplicationPartManager partManager)
|
|
||||||
{
|
|
||||||
_partManager = partManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<string> GetList()
|
|
||||||
{
|
|
||||||
return _partManager.ApplicationParts.Select(x => x.Name);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,6 +1,3 @@
|
||||||
using Dipper.Alioth.Starlets;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
namespace Dipper.Alioth.Options;
|
namespace Dipper.Alioth.Options;
|
||||||
|
|
||||||
public class StarOption
|
public class StarOption
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Dipper.Alioth.Starlets;
|
|
||||||
using Microsoft.AspNetCore.Mvc.Controllers;
|
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||||
|
|
||||||
namespace Dipper.Alioth.Providers;
|
namespace Dipper.Alioth.Providers;
|
||||||
|
|
||||||
public class ApiFeatureProvider : ControllerFeatureProvider
|
public class StarletFeatureProvider : ControllerFeatureProvider
|
||||||
{
|
{
|
||||||
protected override bool IsController(TypeInfo typeInfo)
|
protected override bool IsController(TypeInfo typeInfo)
|
||||||
{
|
{
|
|
@ -1,6 +1,4 @@
|
||||||
using Dipper.Alioth.Starlets;
|
namespace Dipper.Alioth.Services;
|
||||||
|
|
||||||
namespace Dipper.Alioth;
|
|
||||||
|
|
||||||
public class DomainAsterism : IAsterism
|
public class DomainAsterism : IAsterism
|
||||||
{
|
{
|
|
@ -0,0 +1,28 @@
|
||||||
|
namespace Dipper.Alioth.Services;
|
||||||
|
|
||||||
|
public class ManagerStarlet : IStarlet
|
||||||
|
{
|
||||||
|
private readonly ApplicationPartManager _partManager;
|
||||||
|
|
||||||
|
|
||||||
|
public ManagerStarlet(ApplicationPartManager partManager)
|
||||||
|
{
|
||||||
|
_partManager = partManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<string> GetList()
|
||||||
|
{
|
||||||
|
return _partManager.ApplicationParts.Select(x => x.Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Remove(string name)
|
||||||
|
{
|
||||||
|
var part = _partManager.ApplicationParts.FirstOrDefault(part => part.Name == name);
|
||||||
|
if (part is null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _partManager.ApplicationParts.Remove(part);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,3 @@
|
||||||
using Dipper.Alioth.Options;
|
|
||||||
|
|
||||||
namespace Dipper.Alioth;
|
namespace Dipper.Alioth;
|
||||||
|
|
||||||
public abstract class StarHost
|
public abstract class StarHost
|
||||||
|
@ -7,6 +5,4 @@ public abstract class StarHost
|
||||||
public abstract void Run(string[] args, Action<StarOption> action);
|
public abstract void Run(string[] args, Action<StarOption> action);
|
||||||
|
|
||||||
public abstract Task RunAsync(string[] args, Action<StarOption> action);
|
public abstract Task RunAsync(string[] args, Action<StarOption> action);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,6 +1,4 @@
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Dipper.Alioth.Starlets;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.AspNetCore.Mvc.ActionConstraints;
|
using Microsoft.AspNetCore.Mvc.ActionConstraints;
|
||||||
using Microsoft.AspNetCore.Mvc.ApplicationModels;
|
using Microsoft.AspNetCore.Mvc.ApplicationModels;
|
||||||
|
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
using System.Reflection;
|
|
||||||
using Dipper.Alioth.Starlets;
|
|
||||||
using Microsoft.AspNetCore.Mvc.Controllers;
|
|
||||||
|
|
||||||
namespace Dipper.Alioth.Web;
|
|
||||||
|
|
||||||
public class StarletFeatureProvider : ControllerFeatureProvider
|
|
||||||
{
|
|
||||||
protected override bool IsController(TypeInfo typeInfo)
|
|
||||||
{
|
|
||||||
return typeof(IStarlet).IsAssignableFrom(typeInfo) && typeInfo.IsPublic
|
|
||||||
&& !typeInfo.IsAbstract && !typeInfo.IsGenericType;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,6 +1,4 @@
|
||||||
using Dipper.Alioth.Options;
|
|
||||||
using Microsoft.AspNetCore.Builder;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
|
|
||||||
namespace Dipper.Alioth.Web;
|
namespace Dipper.Alioth.Web;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
using Dipper.Alioth;
|
using Dipper.Alioth;
|
||||||
|
using Dipper.Alioth.Extensions;
|
||||||
|
using Dipper.Alioth.Services;
|
||||||
using Dipper.Alioth.Web;
|
using Dipper.Alioth.Web;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
Loading…
Reference in New Issue