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
namespace Demo | |
{ | |
public class EditableCacheAttribute : ContentOutputCacheAttribute | |
{ | |
public EditableCacheAttribute() | |
{ | |
UseOutputCacheValidator = UseOutputCache; | |
} | |
private static bool UseOutputCache(IPrincipal principal, HttpContextBase context, TimeSpan duration) |
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
$webappname = "myepienvironment" # Application name (lowercase alphanumeric only) | |
$subscriptionname = "My subscription name" | |
$resourcegroupname ="$webappname-ResourceGroup" | |
$location="West Europe" | |
$sqladminlogin = "SaUser" | |
$sqlpassword = "YourSecretAdminPassword1" | |
$startip = "111.112.113.114" | |
$endip = "111.112.113.114" | |
$storageaccountname = "$($webappname)media" |
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
# DXC-S deploy from source environment to target environment. Step two, finish the deploy by swapping slots. | |
if (-not (Get-Module -Name EpiCloud -ListAvailable)) { | |
Install-Module EpiCloud -Scope CurrentUser -Force | |
Write-Host "Installed EpiCloud module." | |
} | |
Connect-EpiCloud -ClientKey $OctopusParameters["DXC-S API Key"] -ClientSecret $OctopusParameters["DXC-S API Secret"] | |
# Find a deployment that has the status "AwaitingVerification". |
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
# DXC-S deploy from source environment to target environment. Step one that deploys to a slot on target. | |
# Install the EpiCloud module | |
if (-not (Get-Module -Name EpiCloud -ListAvailable)) { | |
Install-Module EpiCloud -Scope CurrentUser -Force | |
Write-Output "Installed EpiCloud module" | |
} | |
Connect-EpiCloud -ClientKey $OctopusParameters["DXC-S API Key"] -ClientSecret $OctopusParameters["DXC-S API Secret"] |
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
namespace AlloyDemo.Controllers | |
{ | |
[TemplateDescriptor(Inherited = true)] | |
public class DefaultPageController : PageControllerBase<SitePageData> | |
{ | |
[EditableContentOutputCache] | |
public ViewResult Index(SitePageData currentPage) | |
{ | |
var model = CreateModel(currentPage); | |
return View($"~/Views/{currentPage.GetOriginalType().Name}/Index.cshtml", model); |
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
namespace AlloyDemo.Models.Pages | |
{ | |
public abstract class SitePageData : PageData, ICustomCssInContentArea, IDisableOutputCache | |
{ | |
[Display(Name = "Disable output cache", GroupName = SystemTabNames.Settings, Order = 500)] | |
public virtual bool? DisableOutputCache { get; set; } | |
... | |
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
namespace AlloyDemo.Business | |
{ | |
public sealed class EditableContentOutputCacheAttribute : ContentOutputCacheAttribute | |
{ | |
public EditableContentOutputCacheAttribute() | |
{ | |
UseOutputCacheValidator = UseOutputCache; | |
} | |
private static bool UseOutputCache(IPrincipal principal, HttpContextBase context, TimeSpan duration) |
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
namespace AlloyDemo.Business | |
{ | |
public interface IDisableOutputCache | |
{ | |
bool? DisableOutputCache { get; set; } | |
} | |
} |
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
.\LoginToAzure.ps1 | |
#scale down web app to "D1 Shared" | |
Set-AzureRmAppServicePlan -Name "<your sesrvice plan name>" -ResourceGroupName "<your resource group name>" -Tier Shared | |
#scale down database to "B1 Basic" | |
Set-AzureRmSqlDatabase -ResourceGroupName "<your resource group name>" -ServerName "<sql server name>" -DatabaseName "<database name>" -Edition Basic | |
#scale a web app to "B2 Basic" | |
#Set-AzureRmAppServicePlan -Name "<your sesrvice plan name>" -ResourceGroupName "<your resource group name>" -Tier Basic -WorkerSize Medium |
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
$connectionName = "AzureRunAsConnection" | |
try | |
{ | |
# Get the connection "AzureRunAsConnection " | |
$servicePrincipalConnection=Get-AutomationConnection -Name $connectionName | |
"Logging in to Azure..." | |
Add-AzureRmAccount ` | |
-ServicePrincipal ` | |
-TenantId $servicePrincipalConnection.TenantId ` |
NewerOlder