-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from CloudBreadProject/2.0.0-dev
2.0.0 dev-Alpha
- Loading branch information
Showing
2,105 changed files
with
3,232 additions
and
2,212,432 deletions.
There are no files selected for viewing
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
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Configuration; | ||
using System.Data.Entity; | ||
using System.Web.Http; | ||
using Microsoft.Azure.Mobile.Server; | ||
using Microsoft.Azure.Mobile.Server.Authentication; | ||
using Microsoft.Azure.Mobile.Server.Config; | ||
using CloudBread.DataObjects; | ||
using CloudBread.Models; | ||
using Owin; | ||
|
||
namespace CloudBread | ||
{ | ||
public partial class Startup | ||
{ | ||
public static void ConfigureMobileApp(IAppBuilder app) | ||
{ | ||
HttpConfiguration config = new HttpConfiguration(); | ||
|
||
new MobileAppConfiguration() | ||
.UseDefaultConfiguration() | ||
.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); | ||
} | ||
} | ||
|
||
public class MobileServiceInitializer : CreateDatabaseIfNotExists<MobileServiceContext> | ||
{ | ||
protected override void Seed(MobileServiceContext context) | ||
{ | ||
List<TodoItem> todoItems = new List<TodoItem> | ||
{ | ||
new TodoItem { Id = Guid.NewGuid().ToString(), Text = "First item", Complete = false }, | ||
new TodoItem { Id = Guid.NewGuid().ToString(), Text = "Second item", Complete = false } | ||
}; | ||
|
||
foreach (TodoItem todoItem in todoItems) | ||
{ | ||
context.Set<TodoItem>().Add(todoItem); | ||
} | ||
|
||
base.Seed(context); | ||
} | ||
} | ||
} | ||
|
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.