Created
June 25, 2018 16:54
-
-
Save sfmskywalker/08a8bc7c4ac4717a957fa830f4e7e588 to your computer and use it in GitHub Desktop.
Complete Startup class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Linq; | |
using System.Threading.Tasks; | |
using Microsoft.AspNetCore.Builder; | |
using Microsoft.AspNetCore.Hosting; | |
using Microsoft.AspNetCore.Http; | |
using Microsoft.Extensions.DependencyInjection; | |
namespace MultiTenantApp | |
{ | |
public class Startup | |
{ | |
public void ConfigureServices(IServiceCollection services) | |
{ | |
services | |
.AddOrchardCore() | |
.WithTenants(); | |
} | |
public void Configure(IApplicationBuilder app, IHostingEnvironment env) | |
{ | |
if (env.IsDevelopment()) | |
{ | |
app.UseDeveloperExceptionPage(); | |
} | |
app.UseOrchardCore(a => a.Run(async context => | |
{ | |
var messageProviders = context.RequestServices.GetServices<IMessageProvider>(); | |
var messages = await Task.WhenAll(messageProviders.Select(async x => await x.GetMessageAsync())); | |
var output = string.Join("\r\n", messages); | |
await context.Response.WriteAsync(output); | |
})); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment