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
public static bool GetSetting<T>(string key, ref T output) | |
{ | |
var value = CloudConfigurationManager.GetSetting(key); | |
if (string.IsNullOrWhiteSpace(value) == false) | |
{ | |
try | |
{ | |
output = (T) Convert.ChangeType(value, typeof (T)); | |
return true; | |
} |
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
<StackPanel x:Name="ListingPreviewStackPanel" | |
IsHoldingEnabled="True" | |
Holding="ListingPreview_Holding" | |
FlyoutBase.AttachedFlyout="{StaticResource WintsyListingPreviewFlyout}" | |
Tapped="ListingPreview_Tapped"> | |
</StackPanel> |
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
private void ListingPreview_Holding(object sender, HoldingRoutedEventArgs e) | |
{ | |
FlyoutBase.ShowAttachedFlyout(ListingPreviewStackPanel); | |
} |
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
public class Logger | |
{ | |
private static TelemetryClient telemetry = null; | |
public Logger(string instrumentationKey) | |
{ | |
Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.Active.InstrumentationKey = instrumentationKey; | |
telemetry = new TelemetryClient(); | |
telemetry.Context.InstrumentationKey = instrumentationKey; | |
} |
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
/// <summary> | |
/// A simple implementation to automatically retry transient connection error's to cache. Runs for a maximum of 10 seconds before timing out. | |
/// </summary> | |
protected TResult AttemptCacheCall<TResult>(Func<TResult> codeFunc) | |
{ | |
var timeout = false; | |
var timer = new Timer(10000); | |
timer.Elapsed += (sender, args) => timeout = true; | |
timer.AutoReset = false; | |
timer.Start(); |
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
Azure App Service Plans | |
https://azure.microsoft.com/en-us/documentation/articles/azure-web-sites-web-hosting-plans-in-depth-overview/ | |
DocumentDB Transient Fault Handling | |
https://www.nuget.org/packages/Microsoft.Azure.DocumentDB.TransientFaultHandling/ | |
Mini Transient Fault Handling for Redis (could apply to anything) | |
https://gist.github.com/timgabrhel/8a5ae727bacd87c2d5a9 | |
Cache Aside Pattern |
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
<system.web> | |
<sessionState mode="Custom" customProvider="RedisSessionProvider"> | |
<providers> | |
<add name="RedisSessionProvider" | |
type="Microsoft.Web.Redis.RedisSessionStateProvider" | |
port="6379" | |
host="abc.redis.cache.windows.net" | |
accessKey="abc" | |
ssl="false" | |
connectionTimeoutInMilliseconds="15000" |
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
private static Lazy<ConnectionMultiplexer> lazyConnection = new Lazy<ConnectionMultiplexer>(() => | |
{ | |
return ConnectionMultiplexer.Connect("{redis connection string}"); | |
}); | |
public static ConnectionMultiplexer Connection => lazyConnection.Value; | |
private static IDatabase Cache => Connection.GetDatabase(); | |
private T getCacheObj<T>(string key) | |
{ |
OlderNewer