Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/aspnetcore.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Fowler <davidfowl@gmail.com>2021-03-08 04:41:46 +0300
committerDavid Fowler <davidfowl@gmail.com>2021-03-08 04:41:46 +0300
commit616a8becf1feb7fa809adf3b3b94b43a9a5a29b8 (patch)
treeeb71de22aaf704d016497bfda72a2ac7b2a79b3a
parent13721620ddfdeb824c407e211dcaa019d2353ad2 (diff)
-rw-r--r--src/DefaultBuilder/samples/SampleApp/Program.cs6
-rw-r--r--src/DefaultBuilder/src/PublicAPI.Unshipped.txt28
-rw-r--r--src/DefaultBuilder/src/WebApplication.cs75
-rw-r--r--src/DefaultBuilder/src/WebApplicationBuilder.cs27
4 files changed, 136 insertions, 0 deletions
diff --git a/src/DefaultBuilder/samples/SampleApp/Program.cs b/src/DefaultBuilder/samples/SampleApp/Program.cs
index 1094fbcdc2..a069487899 100644
--- a/src/DefaultBuilder/samples/SampleApp/Program.cs
+++ b/src/DefaultBuilder/samples/SampleApp/Program.cs
@@ -16,6 +16,12 @@ namespace SampleApp
{
public static void Main(string[] args)
{
+ var app = WebApplication.Create(args);
+
+ app.MapGet("/", context => context.Response.WriteAsync("Hello World"));
+
+ app.Run("http://localhost:3000");
+
CreateHostBuilder(args).Build().Run();
}
diff --git a/src/DefaultBuilder/src/PublicAPI.Unshipped.txt b/src/DefaultBuilder/src/PublicAPI.Unshipped.txt
index 7dc5c58110..4f66a78b44 100644
--- a/src/DefaultBuilder/src/PublicAPI.Unshipped.txt
+++ b/src/DefaultBuilder/src/PublicAPI.Unshipped.txt
@@ -1 +1,29 @@
#nullable enable
+Microsoft.AspNetCore.WebApplication
+Microsoft.AspNetCore.WebApplication.Addresses.get -> System.Collections.Generic.IEnumerable<string!>!
+Microsoft.AspNetCore.WebApplication.Configuration.get -> Microsoft.Extensions.Configuration.IConfiguration!
+Microsoft.AspNetCore.WebApplication.Dispose() -> void
+Microsoft.AspNetCore.WebApplication.DisposeAsync() -> System.Threading.Tasks.ValueTask
+Microsoft.AspNetCore.WebApplication.Environment.get -> Microsoft.AspNetCore.Hosting.IWebHostEnvironment!
+Microsoft.AspNetCore.WebApplication.Lifetime.get -> Microsoft.Extensions.Hosting.IHostApplicationLifetime!
+Microsoft.AspNetCore.WebApplication.Logger.get -> Microsoft.Extensions.Logging.ILogger!
+Microsoft.AspNetCore.WebApplication.Run() -> void
+Microsoft.AspNetCore.WebApplication.Run(params string![]! urls) -> void
+Microsoft.AspNetCore.WebApplication.RunAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken), params string![]! urls) -> System.Threading.Tasks.Task!
+Microsoft.AspNetCore.WebApplication.Services.get -> System.IServiceProvider!
+Microsoft.AspNetCore.WebApplication.StartAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task!
+Microsoft.AspNetCore.WebApplication.StopAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task!
+Microsoft.AspNetCore.WebApplication.WebApplication() -> void
+Microsoft.AspNetCore.WebApplicationBuilder
+Microsoft.AspNetCore.WebApplicationBuilder.Build() -> Microsoft.AspNetCore.WebApplication!
+Microsoft.AspNetCore.WebApplicationBuilder.Configuration.get -> Microsoft.Extensions.Configuration.IConfiguration!
+Microsoft.AspNetCore.WebApplicationBuilder.Environment.get -> Microsoft.AspNetCore.Hosting.IWebHostEnvironment!
+Microsoft.AspNetCore.WebApplicationBuilder.Host.get -> Microsoft.Extensions.Hosting.IHostBuilder!
+Microsoft.AspNetCore.WebApplicationBuilder.Logging.get -> Microsoft.Extensions.Logging.ILoggingBuilder!
+Microsoft.AspNetCore.WebApplicationBuilder.Services.get -> Microsoft.Extensions.DependencyInjection.IServiceCollection!
+Microsoft.AspNetCore.WebApplicationBuilder.WebApplicationBuilder() -> void
+Microsoft.AspNetCore.WebApplicationBuilder.WebHost.get -> Microsoft.AspNetCore.Hosting.IWebHostBuilder!
+static Microsoft.AspNetCore.WebApplication.Create() -> Microsoft.AspNetCore.WebApplication!
+static Microsoft.AspNetCore.WebApplication.Create(string![]! args) -> Microsoft.AspNetCore.WebApplication!
+static Microsoft.AspNetCore.WebApplication.CreateBuilder() -> Microsoft.AspNetCore.WebApplicationBuilder!
+static Microsoft.AspNetCore.WebApplication.CreateBuilder(string![]! args) -> Microsoft.AspNetCore.WebApplicationBuilder!
diff --git a/src/DefaultBuilder/src/WebApplication.cs b/src/DefaultBuilder/src/WebApplication.cs
new file mode 100644
index 0000000000..c52d5f2a84
--- /dev/null
+++ b/src/DefaultBuilder/src/WebApplication.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Http.Features;
+using Microsoft.AspNetCore.Routing;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.Hosting;
+using Microsoft.Extensions.Logging;
+
+namespace Microsoft.AspNetCore
+{
+ public class WebApplication : IHost, IDisposable, IAsyncDisposable, IApplicationBuilder, IEndpointRouteBuilder
+ {
+ // Top level properties to access common services
+ public ILogger Logger => default!;
+ public IEnumerable<string> Addresses => default!;
+ public IHostApplicationLifetime Lifetime => default!;
+ public IServiceProvider Services => default!;
+ public IConfiguration Configuration => default!;
+ public IWebHostEnvironment Environment => default!;
+
+ // Factory methods
+ public static WebApplication Create(string[] args) => default!;
+ public static WebApplication Create() => default!;
+ public static WebApplicationBuilder CreateBuilder() => default!;
+ public static WebApplicationBuilder CreateBuilder(string[] args) => default!;
+
+ // Methods used to start the host
+ public void Run(params string[] urls) { }
+ public void Run() { }
+ public Task RunAsync(CancellationToken cancellationToken = default, params string[] urls) => Task.CompletedTask;
+ public Task StartAsync(CancellationToken cancellationToken = default) => Task.CompletedTask;
+ public Task StopAsync(CancellationToken cancellationToken = default) => Task.CompletedTask;
+
+ public void Dispose() { }
+ public ValueTask DisposeAsync() => ValueTask.CompletedTask;
+
+ IServiceProvider IApplicationBuilder.ApplicationServices { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
+
+ IFeatureCollection IApplicationBuilder.ServerFeatures => throw new NotImplementedException();
+
+ IDictionary<string, object?> IApplicationBuilder.Properties => throw new NotImplementedException();
+
+ IServiceProvider IEndpointRouteBuilder.ServiceProvider => throw new NotImplementedException();
+
+ ICollection<EndpointDataSource> IEndpointRouteBuilder.DataSources => throw new NotImplementedException();
+
+
+ IApplicationBuilder IApplicationBuilder.Use(Func<RequestDelegate, RequestDelegate> middleware)
+ {
+ throw new NotImplementedException();
+ }
+
+ IApplicationBuilder IApplicationBuilder.New()
+ {
+ throw new NotImplementedException();
+ }
+
+ RequestDelegate IApplicationBuilder.Build()
+ {
+ throw new NotImplementedException();
+ }
+
+ IApplicationBuilder IEndpointRouteBuilder.CreateApplicationBuilder()
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/src/DefaultBuilder/src/WebApplicationBuilder.cs b/src/DefaultBuilder/src/WebApplicationBuilder.cs
new file mode 100644
index 0000000000..77b5abcbf0
--- /dev/null
+++ b/src/DefaultBuilder/src/WebApplicationBuilder.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Hosting;
+using Microsoft.Extensions.Logging;
+
+namespace Microsoft.AspNetCore
+{
+ public class WebApplicationBuilder
+ {
+ public IWebHostEnvironment Environment => default!;
+ public IServiceCollection Services => default!;
+ public IConfiguration Configuration => default!;
+ public ILoggingBuilder Logging => default!;
+
+ // Ability to configure existing web host and host
+ public IWebHostBuilder WebHost => default!;
+ public IHostBuilder Host => default!;
+
+ public WebApplication Build() => default!;
+ }
+}