Some fixes
1. Updating some startup classes like templates 2. Update a test that runs on mono with right CLR.
This commit is contained in:
parent
12858aef79
commit
5ae536fe0a
|
|
@ -4,8 +4,6 @@ using Microsoft.AspNet.Diagnostics;
|
|||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Identity;
|
||||
using Microsoft.AspNet.Routing;
|
||||
using Microsoft.AspNet.Security.Cookies;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.Framework.ConfigurationModel;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using MusicStore.Models;
|
||||
|
|
@ -13,7 +11,6 @@ using Microsoft.AspNet.Security.Facebook;
|
|||
using Microsoft.AspNet.Security.Google;
|
||||
using Microsoft.AspNet.Security.Twitter;
|
||||
using Microsoft.AspNet.Security.MicrosoftAccount;
|
||||
using Microsoft.AspNet.Security;
|
||||
using Microsoft.Framework.Cache.Memory;
|
||||
using MusicStore.Mocks.Common;
|
||||
using MusicStore.Mocks.Facebook;
|
||||
|
|
@ -27,46 +24,44 @@ namespace MusicStore
|
|||
{
|
||||
public class StartupSocialTesting
|
||||
{
|
||||
public void Configure(IApplicationBuilder app)
|
||||
public StartupSocialTesting()
|
||||
{
|
||||
Console.WriteLine("Social Testing mode...");
|
||||
//Below code demonstrates usage of multiple configuration sources. For instance a setting say 'setting1' is found in both the registered sources,
|
||||
//then the later source will win. By this way a Local config can be overridden by a different setting while deployed remotely.
|
||||
var configuration = new Configuration()
|
||||
Configuration = new Configuration()
|
||||
.AddJsonFile("config.json")
|
||||
.AddEnvironmentVariables(); //All environment variables in the process's context flow in as configuration values.
|
||||
}
|
||||
|
||||
public IConfiguration Configuration { get; private set; }
|
||||
|
||||
public void Configure(IApplicationBuilder app)
|
||||
{
|
||||
//Error page middleware displays a nice formatted HTML page for any unhandled exceptions in the request pipeline.
|
||||
//Note: ErrorPageOptions.ShowAll to be used only at development time. Not recommended for production.
|
||||
app.UseErrorPage(ErrorPageOptions.ShowAll);
|
||||
|
||||
app.UseServices(services =>
|
||||
{
|
||||
//If this type is present - we're on mono
|
||||
var runningOnMono = Type.GetType("Mono.Runtime") != null;
|
||||
//Sql client not available on mono
|
||||
var useInMemoryStore = Type.GetType("Mono.Runtime") != null;
|
||||
|
||||
// Add EF services to the services container
|
||||
if (runningOnMono)
|
||||
if (useInMemoryStore)
|
||||
{
|
||||
services.AddEntityFramework()
|
||||
services.AddEntityFramework(Configuration)
|
||||
.AddInMemoryStore()
|
||||
.AddDbContext<MusicStoreContext>(options =>
|
||||
{
|
||||
options.UseInMemoryStore();
|
||||
}); ;
|
||||
.AddDbContext<MusicStoreContext>();
|
||||
}
|
||||
else
|
||||
{
|
||||
services.AddEntityFramework()
|
||||
services.AddEntityFramework(Configuration)
|
||||
.AddSqlServer()
|
||||
.AddDbContext<MusicStoreContext>(options =>
|
||||
{
|
||||
options.UseSqlServer(configuration.Get("Data:DefaultConnection:ConnectionString"));
|
||||
});
|
||||
.AddDbContext<MusicStoreContext>();
|
||||
}
|
||||
|
||||
// Add Identity services to the services container
|
||||
services.AddDefaultIdentity<MusicStoreContext, ApplicationUser, IdentityRole>(configuration);
|
||||
services.AddDefaultIdentity<MusicStoreContext, ApplicationUser, IdentityRole>(Configuration);
|
||||
|
||||
services.ConfigureFacebookAuthentication(options =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ using Microsoft.AspNet.Builder;
|
|||
using Microsoft.AspNet.Diagnostics;
|
||||
using Microsoft.AspNet.Identity;
|
||||
using Microsoft.AspNet.Routing;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.Framework.ConfigurationModel;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using MusicStore.Models;
|
||||
|
|
@ -26,31 +25,25 @@ namespace MusicStore
|
|||
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
//If this type is present - we're on mono
|
||||
var runningOnMono = Type.GetType("Mono.Runtime") != null;
|
||||
//Sql client not available on mono
|
||||
var useInMemoryStore = Type.GetType("Mono.Runtime") != null;
|
||||
|
||||
// Add EF services to the services container
|
||||
if (runningOnMono)
|
||||
if (useInMemoryStore)
|
||||
{
|
||||
services.AddEntityFramework()
|
||||
services.AddEntityFramework(Configuration)
|
||||
.AddInMemoryStore()
|
||||
.AddDbContext<MusicStoreContext>(options =>
|
||||
{
|
||||
options.UseInMemoryStore();
|
||||
}); ;
|
||||
.AddDbContext<MusicStoreContext>();
|
||||
}
|
||||
else
|
||||
{
|
||||
services.AddEntityFramework()
|
||||
services.AddEntityFramework(Configuration)
|
||||
.AddSqlServer()
|
||||
.AddDbContext<MusicStoreContext>(options =>
|
||||
{
|
||||
options.UseSqlServer(Configuration.Get("Data:DefaultConnection:ConnectionString"));
|
||||
});
|
||||
.AddDbContext<MusicStoreContext>();
|
||||
}
|
||||
|
||||
// Add Identity services to the services container
|
||||
services.AddDefaultIdentity<MusicStoreContext, ApplicationUser, IdentityRole>(Configuration.GetSubKey("Identity"));
|
||||
services.AddDefaultIdentity<MusicStoreContext, ApplicationUser, IdentityRole>(Configuration);
|
||||
|
||||
services.ConfigureFacebookAuthentication(options =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ using System;
|
|||
using Microsoft.AspNet.Builder;
|
||||
using Microsoft.AspNet.Diagnostics;
|
||||
using Microsoft.AspNet.Routing;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.Framework.ConfigurationModel;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using MusicStore.Models;
|
||||
|
|
@ -30,6 +29,17 @@ namespace MusicStore
|
|||
/// </summary>
|
||||
public class StartupNtlmAuthentication
|
||||
{
|
||||
public StartupNtlmAuthentication()
|
||||
{
|
||||
//Below code demonstrates usage of multiple configuration sources. For instance a setting say 'setting1' is found in both the registered sources,
|
||||
//then the later source will win. By this way a Local config can be overridden by a different setting while deployed remotely.
|
||||
Configuration = new Configuration()
|
||||
.AddJsonFile("config.json")
|
||||
.AddEnvironmentVariables(); //All environment variables in the process's context flow in as configuration values.
|
||||
}
|
||||
|
||||
public IConfiguration Configuration { get; private set; }
|
||||
|
||||
public void Configure(IApplicationBuilder app)
|
||||
{
|
||||
//Set up NTLM authentication for WebListener like below.
|
||||
|
|
@ -56,12 +66,6 @@ namespace MusicStore
|
|||
await next.Invoke();
|
||||
});
|
||||
|
||||
//Below code demonstrates usage of multiple configuration sources. For instance a setting say 'setting1' is found in both the registered sources,
|
||||
//then the later source will win. By this way a Local config can be overridden by a different setting while deployed remotely.
|
||||
var configuration = new Configuration()
|
||||
.AddJsonFile("config.json")
|
||||
.AddEnvironmentVariables(); //All environment variables in the process's context flow in as configuration values.
|
||||
|
||||
//Error page middleware displays a nice formatted HTML page for any unhandled exceptions in the request pipeline.
|
||||
//Note: ErrorPageOptions.ShowAll to be used only at development time. Not recommended for production.
|
||||
app.UseErrorPage(ErrorPageOptions.ShowAll);
|
||||
|
|
@ -69,15 +73,12 @@ namespace MusicStore
|
|||
app.UseServices(services =>
|
||||
{
|
||||
// Add EF services to the services container
|
||||
services.AddEntityFramework()
|
||||
services.AddEntityFramework(Configuration)
|
||||
.AddSqlServer()
|
||||
.AddDbContext<MusicStoreContext>(options =>
|
||||
{
|
||||
options.UseSqlServer(configuration.Get("Data:DefaultConnection:ConnectionString"));
|
||||
});
|
||||
.AddDbContext<MusicStoreContext>();
|
||||
|
||||
// Add Identity services to the services container
|
||||
services.AddDefaultIdentity<MusicStoreContext, ApplicationUser, IdentityRole>(configuration.GetSubKey("Identity"));
|
||||
services.AddDefaultIdentity<MusicStoreContext, ApplicationUser, IdentityRole>(Configuration);
|
||||
|
||||
// Add MVC services to the services container
|
||||
services.AddMvc();
|
||||
|
|
@ -117,4 +118,4 @@ namespace MusicStore
|
|||
SampleData.InitializeMusicStoreDatabaseAsync(app.ApplicationServices).Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,5 +5,10 @@
|
|||
"DefaultConnection": {
|
||||
"Connectionstring": "Server=(localdb)\\MSSQLLocalDB;Database=MusicStore;Trusted_Connection=True;MultipleActiveResultSets=true"
|
||||
}
|
||||
},
|
||||
"EntityFramework": {
|
||||
"MusicStoreContext": {
|
||||
"ConnectionStringKey": "Data:DefaultConnection:ConnectionString"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@ namespace E2ETests
|
|||
[InlineData(ServerType.WebListener, KreFlavor.DesktopClr, KreArchitecture.amd64, "http://localhost:5002/", false)]
|
||||
//https://github.com/aspnet/KRuntime/issues/642
|
||||
//[InlineData(ServerType.Helios, KreFlavor.CoreClr, KreArchitecture.amd64, "http://localhost:5001/", false)]
|
||||
[InlineData(ServerType.Kestrel, KreFlavor.DesktopClr, KreArchitecture.x86, "http://localhost:5004/", true)]
|
||||
[InlineData(ServerType.Kestrel, KreFlavor.Mono, KreArchitecture.x86, "http://localhost:5004/", true)]
|
||||
public void PublishAndRunTests(ServerType serverType, KreFlavor kreFlavor, KreArchitecture architecture, string applicationBaseUrl, bool RunTestOnMono = false)
|
||||
{
|
||||
Console.WriteLine("Variation Details : HostType = {0}, KreFlavor = {1}, Architecture = {2}, applicationBaseUrl = {3}", serverType, kreFlavor, architecture, applicationBaseUrl);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using Xunit;
|
||||
|
||||
namespace E2ETests
|
||||
|
|
@ -87,6 +88,7 @@ namespace E2ETests
|
|||
{
|
||||
Console.WriteLine("Failed to complete the request with error: {0}", exception.ToString());
|
||||
Console.WriteLine("Retrying request..");
|
||||
Thread.Sleep(1 * 1000); //Wait for a second before retry
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue