Skip to content

Instantly share code, notes, and snippets.

@sfmskywalker
Created June 25, 2018 16:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sfmskywalker/08a8bc7c4ac4717a957fa830f4e7e588 to your computer and use it in GitHub Desktop.
Save sfmskywalker/08a8bc7c4ac4717a957fa830f4e7e588 to your computer and use it in GitHub Desktop.
Complete Startup class
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