Last active
December 15, 2016 16:21
-
-
Save yuka1984/7739da28ff6d90e1258661dc4ab6b1cd to your computer and use it in GitHub Desktop.
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 void ConfigureMobileApp(IAppBuilder app) | |
{ | |
HttpConfiguration config = new HttpConfiguration(); | |
/* | |
new MobileAppConfiguration() | |
.UseDefaultConfiguration() | |
.ApplyTo(config); | |
*/ | |
new MobileAppConfiguration() | |
.AddTables( | |
new MobileAppTableConfiguration() | |
.MapTableControllers() | |
.AddEntityFramework() | |
) | |
.MapApiControllers() | |
.AddPushNotifications() | |
//.AddMobileAppHomeController() | |
.ApplyTo(config); | |
// Use Entity Framework Code First to create database tables based on your DbContext | |
Database.SetInitializer(new MobileServiceInitializer()); | |
MobileAppSettingsDictionary settings = config.GetMobileAppSettingsProvider().GetMobileAppSettings(); | |
if (string.IsNullOrEmpty(settings.HostName)) | |
{ | |
app.UseAppServiceAuthentication(new AppServiceAuthenticationOptions | |
{ | |
// This middleware is intended to be used locally for debugging. By default, HostName will | |
// only have a value when running in an App Service application. | |
SigningKey = ConfigurationManager.AppSettings["SigningKey"], | |
ValidAudiences = new[] { ConfigurationManager.AppSettings["ValidAudience"] }, | |
ValidIssuers = new[] { ConfigurationManager.AppSettings["ValidIssuer"] }, | |
TokenHandler = config.GetAppServiceTokenHandler() | |
}); | |
} | |
app.UseWebApi(config); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment