Created
June 9, 2014 16:36
-
-
Save miso-soup/93f4166cff03159d2dee to your computer and use it in GitHub Desktop.
MyOwinAppBuilderExtension - Microsoft Azure Mobile Service
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
using Microsoft.WindowsAzure.Mobile.Service.Config; | |
using Owin; | |
using System; | |
using System.Web.Http; | |
namespace WebApplication76.App_Start | |
{ | |
public class MyOwinAppBuilderExtension : IOwinAppBuilderExtension | |
{ | |
public MyOwinAppBuilderExtension(HttpConfiguration config) | |
{ | |
if (config == null) | |
throw new ArgumentException("config"); | |
_config = config; | |
} | |
private HttpConfiguration _config; | |
public void Configure(IAppBuilder appBuilder) | |
{ | |
if (appBuilder == null) | |
throw new ArgumentException("appBuilder"); | |
MapExtensions.Map(appBuilder, "/nancy", delegate(IAppBuilder nancy) | |
{ | |
this.ConfigureNancy(nancy); | |
}); | |
MapExtensions.Map(appBuilder, "/node", delegate(IAppBuilder lightNode) | |
{ | |
this.ConfigureLightNode(lightNode); | |
}); | |
} | |
private void ConfigureNancy(IAppBuilder appBuilder) | |
{ | |
appBuilder.UseNancy(); | |
} | |
private void ConfigureLightNode(IAppBuilder appBuilder) | |
{ | |
appBuilder.UseLightNode(); | |
} | |
} | |
} |
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
<?xml version="1.0" encoding="utf-8"?> | |
<packages> | |
<package id="Autofac" version="3.3.1" targetFramework="net451" /> | |
<package id="AutoMapper" version="3.1.1" targetFramework="net451" /> | |
<package id="EntityFramework" version="6.1.0" targetFramework="net451" /> | |
<package id="LightNode.Core" version="0.3.0" targetFramework="net451" /> | |
<package id="LightNode.Server" version="0.3.0" targetFramework="net451" /> | |
<package id="Microsoft.AspNet.Identity.Core" version="2.0.1" targetFramework="net451" /> | |
<package id="Microsoft.AspNet.Identity.Owin" version="2.0.1" targetFramework="net451" /> | |
<package id="Microsoft.AspNet.Razor" version="3.1.1" targetFramework="net451" /> | |
<package id="Microsoft.AspNet.WebApi.Client" version="5.1.2" targetFramework="net451" /> | |
<package id="Microsoft.AspNet.WebApi.Core" version="5.1.2" targetFramework="net451" /> | |
<package id="Microsoft.AspNet.WebApi.OData" version="5.1.1" targetFramework="net451" /> | |
<package id="Microsoft.AspNet.WebApi.Owin" version="5.1.2" targetFramework="net451" /> | |
<package id="Microsoft.AspNet.WebApi.Tracing" version="5.1.2" targetFramework="net451" /> | |
<package id="Microsoft.Data.Edm" version="5.6.0" targetFramework="net451" /> | |
<package id="Microsoft.Data.OData" version="5.6.0" targetFramework="net451" /> | |
<package id="Microsoft.Owin" version="2.1.0" targetFramework="net451" /> | |
<package id="Microsoft.Owin.Host.SystemWeb" version="2.1.0" targetFramework="net451" /> | |
<package id="Microsoft.Owin.Security" version="2.1.0" targetFramework="net451" /> | |
<package id="Microsoft.Owin.Security.ActiveDirectory" version="2.1.0" targetFramework="net451" /> | |
<package id="Microsoft.Owin.Security.Cookies" version="2.1.0" targetFramework="net451" /> | |
<package id="Microsoft.Owin.Security.Facebook" version="2.1.0" targetFramework="net451" /> | |
<package id="Microsoft.Owin.Security.Google" version="2.1.0" targetFramework="net451" /> | |
<package id="Microsoft.Owin.Security.Jwt" version="2.1.0" targetFramework="net451" /> | |
<package id="Microsoft.Owin.Security.MicrosoftAccount" version="2.1.0" targetFramework="net451" /> | |
<package id="Microsoft.Owin.Security.OAuth" version="2.1.0" targetFramework="net451" /> | |
<package id="Microsoft.Owin.Security.Twitter" version="2.1.0" targetFramework="net451" /> | |
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="2.0.3" targetFramework="net451" /> | |
<package id="Nancy" version="0.23.0" targetFramework="net451" /> | |
<package id="Nancy.Owin" version="0.23.0" targetFramework="net451" /> | |
<package id="Newtonsoft.Json" version="6.0.1" targetFramework="net451" /> | |
<package id="Owin" version="1.0" targetFramework="net451" /> | |
<package id="RazorEngine" version="3.4.1" targetFramework="net451" /> | |
<package id="System.IdentityModel.Tokens.Jwt" version="3.0.2" targetFramework="net451" /> | |
<package id="System.Spatial" version="5.6.0" targetFramework="net451" /> | |
<package id="WindowsAzure.MobileServices.Backend" version="1.0.303" targetFramework="net451" /> | |
<package id="WindowsAzure.MobileServices.Backend.Entity" version="1.0.258" targetFramework="net451" /> | |
<package id="WindowsAzure.MobileServices.Backend.Tables" version="1.0.258" targetFramework="net451" /> | |
<package id="WindowsAzure.ServiceBus" version="2.2.6.0" targetFramework="net451" /> | |
</packages> |
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
using WebApplication76.App_Start; | |
using Autofac; | |
using System.Reflection; | |
namespace WebApplication76 | |
{ | |
public static class WebApiConfig | |
{ | |
public static void Register() | |
{ | |
// Use this class to set configuration options for your mobile service | |
ConfigOptions options = new ConfigOptions(); | |
// Use this class to set WebAPI configuration options | |
HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options, (httpConfig, autofac) => | |
{ | |
autofac.RegisterInstance(new MyOwinAppBuilderExtension(httpConfig)).As<IOwinAppBuilderExtension>(); | |
})); | |
// ..... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment