Skip to content

Instantly share code, notes, and snippets.

View dilhan2013's full-sized avatar

Dilhan Jayathilake dilhan2013

View GitHub Profile
@dilhan2013
dilhan2013 / hangfire-simple-injector.md
Last active May 11, 2017 00:37
Hangfire with Simple Injector

Hangfire - Using Dependancy Injection (Simple Injector)

This guide provide the basic steps required to successfuly implement dependancy injection with Hangfire (https://www.hangfire.io) backgroud task processor engine.

First of all just read this article from Hangfire docs to understand the basics of using IOC container with Hangfire.

I am using the following IOC extention in this example. Hangfire.SimpleInjector.

@dilhan2013
dilhan2013 / Permission based angular routes
Created May 5, 2017 06:53
Permission based angular routes (ui-router 2)
.run(($transitions, $state, $injector) => {
$transitions.onBefore({
to: 'app.**'
}, () => {
const $window = $injector.get('$window');
if (!$window.sessionStorage.getItem('user')) {
return $state.target('login', $state.transition.params());
}
return true
});
@dilhan2013
dilhan2013 / HangFire.SimpleInjector.Integration.OWIN.txt
Last active February 18, 2017 04:11
HangFire SimpleInjector Integration - ASP.NET Web Application
Step 1:
Install HangFire.SimpleInjector NuGet from
https://www.nuget.org/packages/Hangfire.SimpleInjector/
Step 2:
Add following code block in Global.asax.cs file,
protected void Application_Start(object sender, EventArgs e)
{
// this code sniplet assumes that you have installed cordova in app browser plugin
// ios and android
function openFile(url) {
window.resolveLocalFileSystemURL(url, function (fileEntry) {
var ios = cordova.file.cacheDirectory;
var ext = cordova.file.externalCacheDirectory;
var dir = (ext) ? ext : ios;