Skip to content

Instantly share code, notes, and snippets.

@sfmskywalker
sfmskywalker / Startup.cs
Created June 27, 2018 10:51
Partial Startup
app.UseOrchardCore(a => a.Run(async context =>
{
// ShellSettings provide the tenant's configuration.
var shellSettings = context.RequestServices.GetRequiredService<ShellSettings>();
// Read the tenant-specific custom setting.
var customSetting = shellSettings.Configuration["CustomSetting"];
// Resolve all registered IMessageProvider services.
var messageProviders = context.RequestServices.GetServices<IMessageProvider>();
@sfmskywalker
sfmskywalker / tenants.json
Last active June 27, 2018 10:58
Sample tenants.json
{
"CustomerA": {
"State": "Running",
"RequestUrlHost": null,
"RequestUrlPrefix": "customer-a",
"CustomSetting": "Custom setting for Customer A",
"Features": [ "RemoteIp" ]
},
"CustomerB": {
"State": "Running",
@sfmskywalker
sfmskywalker / Startup.cs
Last active July 21, 2018 19:41
Startup with custom configuration
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using OrchardCore.Environment.Shell;
namespace MultiTenantApp
{
@sfmskywalker
sfmskywalker / Startup.cs
Created July 29, 2018 18:56
Startup.cs
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
namespace AngularWidgetsDemo
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
npm i -g @angular/cli
ng new ClientApp --prefix custom
@sfmskywalker
sfmskywalker / IncludeElements.cmd
Last active July 29, 2018 19:16
Add Angular Elements & Polyfill
cd ClientApp
ng add @angular/elements
@sfmskywalker
sfmskywalker / npm-install.cmd
Last active July 29, 2018 20:04
Executes the NPM Install command
cd ClientApp
npm install
ng build
@sfmskywalker
sfmskywalker / DownloadAngularElementSample.ps1
Last active July 29, 2018 20:04
Downloads and extracts a sample Angular Custom Element from GitHub
Add-Type -AssemblyName System.IO.Compression.FileSystem
Invoke-WebRequest -Uri https://github.com/nitayneeman/made-with-love/archive/release/v1.1.0.zip -OutFile ./ClientApp.zip
[System.IO.Compression.ZipFile]::ExtractToDirectory("c:\Code\Orchard Core and Angular\AngularWidgetsDemo\ClientApp.zip", "c:\Code\Orchard Core and Angular\AngularWidgetsDemo")
Rename-Item made-with-love-master ClientApp
@sfmskywalker
sfmskywalker / NewProject.cmd
Last active July 29, 2018 20:25
Create new ASP.NET Core Orchard Core Project
dotnet new web --name "AngularWidgetsDemo"
cd "AngularWidgetsDemo"
dotnet add package "OrchardCore.Application.Cms.Targets" --version 1.0.0-beta2-*
@sfmskywalker
sfmskywalker / InstallCodeGenerationTemplates.cmd
Created July 29, 2018 20:27
Installs the Orchard Core Code Generation Templates
dotnet new -i OrchardCore.Cms.Templates::1.0.0-beta2-*